The ASP.Net community start kit for club websites uses a repeater for its main navigation bars. I couldn’t figure a way to use a repeater as a dropdown menu so I yanked it out and used a menu control.
The steps to replace the repeater with a menu control:
Create a user control controls/navbar.ascx as:
‹%@ Control Language=”C#” AutoEventWireup=”true” CodeFile=”navbar.ascx.cs” Inherits=”controls_navbar” %›
‹asp:sitemapdatasource id=”SiteMapDataSource1″ runat=”server” showstartingnode=”false”›
‹asp:Menu ID=”menu1″ runat=”server”
DataSourceID=”SiteMapDataSource1″
Orientation=”Horizontal”
DynamicEnableDefaultPopOutImage=”false”
StaticEnableDefaultPopOutImage=”false”
›
‹staticmenuitemstyle verticalpadding=”9″ size=”110%”›
‹staticitemtemplate›
‹asp:Label ID=”Label9″ runat=”server”
Text=’‹%# Eval( “Text” ) %›’›
‹/asp:Label›
‹/staticitemtemplate›
‹/asp:Menu›
Register the control in Default.master:
‹%@ Register Src=”controls/navbar.ascx” TagName=”navbar” TagPrefix=”uc1″ %›
Remove everything from between:
‹div id=â€navtopâ€â€ºâ€¹/div›
and from between:
‹div id=â€navbottomâ€â€ºâ€¹/div›
Replace with:
‹div id=”navtop”›‹uc1:navbar ID=”navbartop” runat=”server” /›‹/div›
and:
‹div id=”navbottom”›‹uc1:navbar ID=”bottomnav” runat=”server” /›‹/div›
You must log in to post a comment.