The content you're reading is getting on in years
This post is on the older side and its content may be out of date.
Be sure to visit our blogs homepage for our latest news, updates and information.
CommandPanel is the class used by Sitefinity which represents the one single command panel. If you are creating a custom command panel (based on Composite Control or User Control) you do not need to inherit from this class, but rather implement the ICommandPanelEx interface on your class.
When, on the other hand, you are automatically generating commands or adding commands manually you will be using CommandPanel class. In this article, we are going to give an overview of the usage and members of the CommandPanel class.
switch (viewMode) |
{ |
case "BlogsView": |
case "BlogsPermissionsView": |
Cms.Web.UI.Backend.CommandPanel blogsCommandPanel = new Cms.Web.UI.Backend.CommandPanel(); |
blogsCommandPanel.Title = Messages.ExploreBlogsMogule; |
blogsCommandPanel.AddCommand("BlogsView", ControlUtils.SliceRoute(GetControlPanelRoute(), this.Name), null, Messages.AllBlogs, Messages.AllBlogsDescription, "all"); |
blogsCommandPanel.AddCommand("BlogsPermissionsView", ControlUtils.SliceRoute(GetControlPanelRoute(), this.Name), null, Messages.Permissions, Messages.PermissionsDescription, "globalPerm"); |
list.Add(blogsCommandPanel); |
break; |
default: |
// helper command panel |
Cms.Web.UI.Backend.CommandPanel helperCommandPanel = new Cms.Web.UI.Backend.CommandPanel(); |
helperCommandPanel.AddCommand("BlogsView", "BlogsControlPanel", null, null, Messages.AllBlogs, null, "backWrapp"); |
list.Add(helperCommandPanel); |
// posts command panel |
Cms.Web.UI.Backend.CommandPanel postsCommandPanel = new Cms.Web.UI.Backend.CommandPanel(); |
postsCommandPanel.Title = Messages.ExploreThisBlog; |
postsCommandPanel.AddCommand("PostsView", ControlUtils.SliceRoute(GetControlPanelRoute(), this.Name), null, this.ParentId.ToString(), null, Messages.Posts, null, "all"); |
if(this.Manager.Provider.AllowComments) |
postsCommandPanel.AddCommand("BlogCommentsView", ControlUtils.SliceRoute(GetControlPanelRoute(), this.Name), null, this.ParentId.ToString(), null, Messages.Comments, null, "all"); |
postsCommandPanel.AddCommand("BlogCategoriesView", ControlUtils.SliceRoute(GetControlPanelRoute(), this.Name), null, this.ParentId.ToString(), null, Messages.Categories, null, "all"); |
postsCommandPanel.AddCommand("BlogTagsView", ControlUtils.SliceRoute(GetControlPanelRoute(), this.Name), null, this.ParentId.ToString(), null, Messages.Tags, null, "all"); |
list.Add(postsCommandPanel); |
// blog settings command panel |
Cms.Web.UI.Backend.CommandPanel blogSettingsPanel = new Cms.Web.UI.Backend.CommandPanel(); |
blogSettingsPanel.Title = Messages.BlogSettingsTitle; |
blogSettingsPanel.AddCommand("BlogsSettingsView", "BlogsControlPanel.BlogSettingsView", null, this.ParentId.ToString(), Messages.BlogSettingsTitle, null, "settings"); |
list.Add(blogSettingsPanel); |
break; |
} |
The process of creating a new CommandPanel is very simple. We create a new instance of the CommandPanel class, set its title, add any number of commands we need and finally, we add the instance of the CommandPanel to the collection of command panels stored by the control panel.
blogsCommandPanel.AddCommand("BlogsView", ControlUtils.SliceRoute(GetControlPanelRoute(), this.Name), null, Messages.AllBlogs, Messages.AllBlogsDescription, "all"); |
postsCommandPanel.AddCommand("PostsView", ControlUtils.SliceRoute(GetControlPanelRoute(), this.Name), null, this.ParentId.ToString(), null, Messages.Posts, null, "all"); |
View all posts from The Progress Team on the Progress blog. Connect with us about all things application development and deployment, data integration and digital business.
Let our experts teach you how to use Sitefinity's best-in-class features to deliver compelling digital experiences.
Learn MoreSubscribe to get all the news, info and tutorials you need to build better business apps and sites
Progress collects the Personal Information set out in our Privacy Policy and the Supplemental Privacy notice for residents of California and other US States and uses it for the purposes stated in that policy.
You can also ask us not to share your Personal Information to third parties here: Do Not Sell or Share My Info
We see that you have already chosen to receive marketing materials from us. If you wish to change this at any time you may do so by clicking here.
Thank you for your continued interest in Progress. Based on either your previous activity on our websites or our ongoing relationship, we will keep you updated on our products, solutions, services, company news and events. If you decide that you want to be removed from our mailing lists at any time, you can change your contact preferences by clicking here.