|
Organizing Controls
Compatibility: Sitefinity 3.7
Working with Sitefinity, the Add Controls bar that shows on the right when editing a page, will be something that is used very frequently. The bar is divided into sections, with the first section, being opened automatically after the bar is shown. When using this bar, it sometimes is desirable to change the order in which the sections are shown, change the section in which a control is located, or create your own section.
In this article we will show you how to perform five different changes to the Add Controls bar:
- Change section order.
- Change control order.
- Create new section.
- Duplicate controls.
- Remove controls
All of these changes will be done in the web.config file, which is located in the root of your website. Open this file in Visual Studio, Dreamweaver or just in Notepad. Browse to the <toolboxControls> section, which is around line 400.
Every tool that is mentioned here, can have multiple settings. Depending on the kind of control url= or type= are used. <add name="Header" section="Most popular" url="~/UserControls/Header/Header.ascx" /> <add
name="Generic Content" section="Most popular"
type="Telerik.Cms.Engine.WebControls.GenericContent, Telerik.Cms.Engine"
/>
| add name= |
The name that will be show in the Add Controls bar |
| section= |
The section in the Add Controls bar the control will be placed in. |
| url= |
The url to the file for the control. |
| type= |
The type of control. |
| description= |
Tooltip for the selected control. |
Change section order
The section order is determined by the first time the section name is found in the <toolboxControls> list. If you would like to have the Navigation section appear above the Most popular section, technically you would only have to move one control that has section="navigation" in it, to above all the items that have section="Most popular" in it.
<add name="Site Menu" section="Navigation" url="~/Sitefinity/UserControls/Navigation35/SiteMenu.ascx" /> <add name="Header" section="Most popular" url="~/User_Controls/Header.ascx" /> <add name="Generic Content" section="Most popular" type="Telerik.Cms.Engine.WebControls.GenericContent, Telerik.Cms.Engine" />
To keep the list nice and tidy, it is better to move all the items together that belong to a specific section in total.
Change control order
To change the order the controls are displayed within a section, just move the controls up or down within the list. Changing this code:
<add name="Site Menu" section="Navigation" url="~/Sitefinity/UserControls/Navigation35/SiteMenu.ascx" /> <add name="Site Panelbar" section="Navigation" url="~/Sitefinity/UserControls/Navigation35/SitePanelbar.ascx" />
to:
<add name="Site Panelbar" section="Navigation" url="~/Sitefinity/UserControls/Navigation35/SitePanelbar.ascx" /> <add name="Site Menu" section="Navigation" url="~/Sitefinity/UserControls/Navigation35/SiteMenu.ascx" />
would have the Site Panelbar switch position from below to above the Site Menu.
Create new section
Creating a new section is very easy. Just enter a name that does not yet exist in the section="" settings. If you want to create a section stating your clients name as sectionname, just enter the Clientname:
<add name="Header" section="Clientname" url="~/User_Controls/Header.ascx" /> <add name="Generic Content" section="Clientname" type="Telerik.Cms.Engine.WebControls.GenericContent, Telerik.Cms.Engine" /> <add name="Image" section="Clientname" type="Telerik.Cms.Engine.WebControls.SitefinityImage, Telerik.Cms.Engine" />
The code above would show a section named Clientname, holding the Header, Generic Content and Image control.
Duplicate controls
In order to duplicate controls it is good to know that Section names and Control names are case sensitive! If you would like a control to be displayed in it's original section, but also in the Most popular section or in a new section, copy the line for the control of your choice and paste it at another location in the <toolboxControls> list.
Now change the name="" setting by changing the case for a letter or just add an extra space after the name:
<add name="Generic Content" section="Most popular" type="Telerik.Cms.Engine.WebControls.GenericContent, Telerik.Cms.Engine" /> <add name="Generic content" section="Most popular" type="Telerik.Cms.Engine.WebControls.GenericContent, Telerik.Cms.Engine" /> <add name="Generic Content " section="Most popular" type="Telerik.Cms.Engine.WebControls.GenericContent, Telerik.Cms.Engine" />
All three controls above are different. Look closely at the name=""settings!
Remove controls
To remove a control, simply delete the corresponding line for the control from the <toolboxControls> section in the web.config file.
|