How can I programmatically select an item from the sitecore content tree and expand it?

advertisements

How can I programatically select a sitecore content tree item and expand it ?

Sitecore version: 6.2 By expanding, I mean expanding the content tree item like in windows explorer ("+").


Ok, I suppose this code will be triggered from somewhere in Content Editor, e.g. by clicking the ribbon button. Then you might need something like this:

 // it is up to you where to get the item from
 Sitecore.Context.ClientPage.SendMessage(this, string.Concat(new object[] { "item:load(id=", item.ID.ToString(), ")" }));
 Sitecore.Context.ClientPage.SendMessage(this, "item:refreshchildren");

I can't imagine the scenario when you might need this functionality, but hope this helps. :)