AI OnAI Off
Something like this should do the trick (you need to use another plug in to select your plug in):
[GuiPlugIn(Area = PlugInArea.EditPanel)]
public class SelectYourEditPanelPlugIn : ICustomPlugInLoader
{
public PlugInDescriptor[] List()
{
// hook LoadComplete-event on EditPanel page
EditPanel editPanel = HttpContext.Current.Handler as EditPanel;
if (null != editPanel)
{
editPanel.LoadComplete += new EventHandler(editPanel_LoadComplete);
}
//Never return a plugin - we don't want to add tabs.
return new PlugInDescriptor[0] { };
}
protected void editPanel_LoadComplete(object sender, EventArgs e)
{
// find the TabStrip with id = "actionTab"
TabStrip actionTabStrip = this.FindControl<TabStrip>(sender as Control, "actionTab");
//Find the tab
if (actionTabStrip != null)
{
int yourPlugInID = PlugInDescriptor.Load(typeof(YourPlugIn)).ID;
foreach (var item in actionTabStrip.Controls)
{
Tab actionTab = item as Tab;
if (actionTab != null && actionTab.PlugInID == yourPlugInID)
{
actionTabStrip.SetSelectedTab(actionTab.ID);
}
}
}
}
// try to locate control of type T with ID==id
// recurses into each childcontrol until first match is found
protected T FindControl<T>(Control control, string id) where T : Control
{
T controlTest = control as T;
if (null != controlTest && (null == id || controlTest.ID.Equals(id)))
return controlTest;
foreach (Control c in control.Controls)
{
controlTest = FindControl<T>(c, id);
if (null != controlTest)
return controlTest;
}
return null;
}
protected T FindControl<T>(Control control) where T : Control
{
return FindControl<T>(control, null);
}
}
See http://labs.episerver.com/en/Blogs/Allan/Dates/2009/1/Neat-Trick-Modifying-Edit-Mode-Tabs/ for more info on where I got the inspiration from
had some problem when trying to move off the tab although moved the call into editPanel_PreLoad instead, so now it only default's to the tab if selected tab is empty.
Yeah, I forgot to add that you should check something in the querystring to see if you should select or not :)
Guys I have created a custom Edit Tree plugin which contains links to specific EPiServer pages when these links are clicked i want the page to open on the main Edit Panel although default to another Custon Edit Panel plugin i have created rather than the preview tab. How can i achieve this
I am using CMS 6 R2