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
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
}
}