private void loadMenuItemsRec(Item root, System.Web.UI.Control ctl) { var menuitems = root.Children; foreach (Item mItem in menuitems) { Control child = null; switch (mItem.Template.Key) { case "toolmenu": //Toolmenu tm = new Toolmenu(); var tm = new Toolmenu { ID = Control.GetUniqueID("T") }; tm.LoadFromItem(mItem); this.loadMenuItemsRec(mItem, tm); child = tm; break; case "toolbar divider": var td = new Tooldivider(); child = td; break; case "toolbutton": var tb = new ToolButton(); //Toolbutton tb = new Toolbutton(); tb.LoadFromItem(mItem); child = tb; break; case "toolmenubutton": //Toolmenubutton tmb = new Toolmenubutton(); var tmb = new ToolMenuButton(); tmb.LoadFromItem(mItem); child = tmb; break; case "menu item": var mi = new MenuItem(); mi.LoadFromItem(mItem); child = mi; break; default: break; } if (child != null) { ctl.Controls.Add(child); } } }
private void createActions() { purgeOldActions(); Tooldivider t = new Tooldivider(); t.ID = Control.GetUniqueID("action"); MyToolbar.Controls.Add(t); foreach (var item in Current.Context.ReportItem.Commands) { Controls.ToolButton ctl = new Controls.ToolButton(); ctl.Header = item.Name; ctl.Icon = item.Icon; ctl.Click = string.Concat("ASRMainFormcommand:", item.Name); ctl.ID = Control.GetUniqueID("action"); MyToolbar.Controls.Add(ctl); } Sitecore.Context.ClientPage.ClientResponse.Refresh(MyToolbar); }
private void createActions() { this.purgeOldActions(); var t = new Tooldivider { ID = Control.GetUniqueID("action") }; this.MyToolbar.Controls.Add(t); foreach (CommandItem item in Current.Context.ReportItem.Commands) { var ctl = new ToolButton { Header = item.Name, Icon = item.Icon, Click = string.Concat("ASRMainFormcommand:", item.Name), ID = Control.GetUniqueID("action") }; this.MyToolbar.Controls.Add(ctl); } Context.ClientPage.ClientResponse.Refresh(this.MyToolbar); }