DotNet Development, SharePoint Customizing, Silverlight, MS Infrastructure and other tips and tricks

Customize the VariationsLabelMenu UserControl

Posted by PANVEGA on August 6, 2008

The VariationLabelMenu.ascx UserControl gives you the oportunity to switch between the variations on your SharePoint Server. You find the Control in the 12er folder under Program Files~\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\CONTROLTEMPLATES” on your SharePoint 2007 Server. The master page associated with your site contains a small ASP.NET user control named VariationLabelsMenu.ascx that Office SharePoint Server 2007 displays on your pages (Picture), which allows a user to jump to the corresponding page in other variations.

default label menu

default label menu

By changing the value LabelMenuConfiguration in the tag <cms:VariationDataSource id=”LabelMenuDataSource” LabelMenuConfiguration=”2″ Filter=”” runat=”server” /> you can choose between different kind of menue layouts. When you are not satisfied with the possibilities, than add you custom CSS style sheet to the UserControl.

Sometimes you have to uncomment a specific line in the control <cms:VariationsLabelEcbMenu id =”varlabelmenu1″ DataSourceID=”LabelMenuDataSource” DisplayText=”<%$Resources:cms,VariationLabelMenuTitle%>” IsCallbackMode=”true” runat=”server” />.


By default the first language usually index[0] can not trigger when no index changed. Simple add the <asp:ListItem Selected=”True” Value=”Choose Country”/> in the asp:DropDownList and all variations trigger the redirection event to the specific site. In addition you have to set AutoPostBack=”true” to throw an event otherwise nothing happens.

You can hide variations from the navigation by clicking Modify Navigation Settings on the Site Settings page at the Site Collection Level.


<asp:DropDownList ID=”MyDropDown” DataSourceID=”LabelMenuDataSource”
AppendDataBoundItems=”true” DataValueField=”NavigateUrl” OnSelectedIndexChanged=”MyDropDown_OnSelectedIndexChanged” OnLoad=”MyInit” AutoPostBack=”true”
DataTextField=”Displaytext” runat=”server” CssClass=”variation” >
<asp:ListItem Selected=”True” Value=”Choose Country”/>
<script type=”text/C#” runat=”server”>

protected void MyInit(object sender, EventArgs e)

PublishingWeb pWeb = PublishingWeb.GetPublishingWeb(SPContext.Current.Web);

protected void MyDropDown_OnSelectedIndexChanged(object sender, EventArgs e)



Before editing the control make a copy and gib´ve the custom control a new name. For example CustomVariationsLabelMenu.ascx and use it in your master page simply changing the register tag.

OLD <%@ Register TagPrefix=”PublishingVariations” TagName=”VariationsLabelMenu” src=”~/_controltemplates/VariationsLabelMenu.ascx” %>

NEW <%@ Register TagPrefix=”PublishingVariations” TagName=”CustomVariationsLabelMenu” src=”~/_controltemplates/CustomVariationsLabelMenu.ascx” %>

In the last step add the following tag <PublishingVariations:VariationsLabelMenu id=”labelmenu1″ runat=”server”/> in your masterpage to show the standard VariationsLabelMenu.

That ´s all you have to modify. Good luck.

Other Blogs:


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: