Creating a Custom User Control for your Site’s Footer

Custom user controls are quite simply awesome. They simplify life by making code, skins, and sites easier to manage. For example, all sites at CSU must have links to the equal opportunity statement, disclaimer statement, privacy policy, CSU search page, and many others (See graphic standards for more info) in the footer. Making a simple change to the footer can become time consuming if you manage several skins. To simply life (and save time) I created a footer user control. I edit the user control any time and the changes are automatically reflected on all skins that reference the control. Here’s how.

1. Create a new file, FooterUserControl.ascx, and add the content below (and your own custom content). Save the file in the Controls folder in Mojoportal.

<div class="footer">
<portal:HomeLink id="HomeLink" runat="server" RenderAsListItem="true" />
<portal:SiteMapLink id="SiteMapLink2" runat="server" CssClass="sitelink" RenderAsListItem="true"  />
<li><a href="">Division of Student Affairs</a></li>
<li><a href="">LSC Work Order</a></li>
<li><a href="">Budget Application</a></li>
<li><a href="">Staff Portal</a></li>
<portal:RegisterLink id="RegisterLink" runat="server" RenderAsListItem="true" />
<portal:LoginLink id="LoginLink" runat="server" RenderAsListItem="true" />
<portal:LogoutLink id="LogoutLink" runat="server" RenderAsListItem="true" />
<li><a href="">Contact CSU</a></li>
<li><a href="">Disclaimer</a></li>
<li><a href="">Equal Opportunity</a></li>
<li><a href="">Privacy Statement</a></li>
<li><portal:SkinPreview id="SkinPreview1" runat="server"></portal:SkinPreview></li>
<li><portal:CopyrightLabel ID="cl1" runat="server"   ShowYear="true" BeginYear="2008" /></li>
<li><portal:XhtmlValidatorLink id="lnkw3cValidator" UseImage="false" runat="server" Html5="true" /></li>
<li><portal:CSSValidatorLink id="lnkCSSVal1" UseImage="false" runat="server" /></li>
Next open your skin’s layout.master and register the new user control

<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="~/App_MasterPages/layout.Master.cs" Inherits="mojoPortal.Web.layout" %>
<%@ Register Src="~/Controls/FooterUserControl.ascx" TagName="FooterUserControl" TagPrefix="uc" %>
Finally, reference the user control on the layout.master file where you’d normally put your footer.

<div id="wrapfooter">
<uc:FooterUserControl id="uc1" runat="server" />

That’s it.