3

I am trying to open a modal dialog from custom ribbon button and i would like to know which item was selected in the content editor within modal popup?

Is there a easy way to achieve this?

Note: I am not using SPEAK

1 Answer 1

4

When you want to open a modal popup from Content Editor ribbon, it should be done using a Sitecore Command.

On your Command class itself, you can find the context item (Selected item), and pass it's Id in querystring of popup.

In the Execute() method of your Command class, your code will look like below.

    public override void Execute(CommandContext context)
    {
        if (context.Items.Length == 1)
        {
            // Get currently selected item in Content Editor tree
            Item currentItem = context.Items[0];

            // to read passed parameters, use context.Parameters["id"];

            // Continue your code for popup    

        }
    }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.