Je bent hier: Sitefinity Made Easy / Using the Header Control maandag 6 februari 2012
Using the Header Control

Compatibility: Sitefinity 3.7

The control that we have used most up untill now is the Header Control. This control is not available through the Sitefinity Marketplace, but is something we came across in a Sitefinity forum post. Unfortunately we cannot find the post anymore and therefor we cannot credit the original creator of this control. If anyone feels they are the one that created this control, please let us know. We will credit where credit is due.

Imagine this: Every time you create a new page, you want to show the Menu Label at the top of your content section, thus setting the Title for that page. However, sometimes you want to use a Custom Title overruling the text that was entered as the Menu Label. All of this can be done by using the Header Control.

In this article we will walk you through the following steps:

  1. Download and extract the control
  2. How to map the control
  3. How to use the control

Download and extract the control

Before the control can be used, it first needs to be downloaded. Choose to save and open, or immediately open the file. After that has been done, extract the contents (Header.ascx and Header.ascx.cs) to a folder that will hold all of your custom controls. In this article the folder ~/UserControls/ will be used. Create a subfolder (called Header in our case) to easily identify your controls if you start to use multiple. Upload folder and files to your live server if necessary.

How to map the control

Next, open the web.config file, which is located in the root of your website in Visual Studio, Dreamweaver or just in Notepad. Browse to the <toolboxControls> section, which is around line 400. Add the following piece of code to that section.

       <add name="Header" section="Most popular" url="~/UserControls/Header/Header.ascx" />

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.

For easy use, this control is placed in the Most popular section. Would you like to use another section, typ the name for the section. If it does not exist, it will be created.

Save the web.config and upload it if needed.

 How to use the control

To use the newly added control, log into Sitefinity or refresh your page if already logged in. Select the page you want to add the Header to and choose Edit this page. In the Add Controls bar you will find the Header control in the section that was entered.

header.png

Drag the control to one of the placeholders on your page. The Menu Label entered for that page will automatically be displayed as a header. In case you would like to overrule this header, just click Edit in the top right corner of the placeholder.

header-settings.png

Enter the desired text in the PageHeader field and click I'm done. The new text will now be shown instead of the Menu Label.

Click Publish to save your changes and repeat this for each page that you want the header to be shown on.

PS: Don't confuse this control with the Custom Page Title Control from Mustafa Kipergil. This control shows the Title field which is used in the Meta-tags, instead of the Menu Label.

>>> Download control

Twitter_48.png Follow us on Twitter and see when a new article is published!

   
   
Copyright 2006 WE ICT   |   Juridische note   |   Algemene voorwaarden   |   Contact