Browse DevX
Sign up for e-mail newsletters from DevX


A La Carte, Part 2: Build Deep, Flexible Navigation Using Four New Controls : Page 2

In part 1, we looked in depth at ASP.NET's new Menu control. But ASP.NET 2.0 includes a whole family of controls that make it easy to create deep, complex, and highly-professional navigational elements, including a "bread crumb" style control that will keep your visitors oriented.




Building the Right Environment to Support AI, Machine Learning and Deep Learning

Customizing the SiteMapPath Control
The default view of the SiteMapPath control displays the navigation path using the string contained in the title attribute of the <siteMapNode> element in the site map file (Listing 1). Each navigation path is separated by the ">" character.

Figure 7. Enhanced Bread Crumb: Customizing the look and feel of the SiteMapPath control.
You can customize the look and feel of the SiteMapPath control by adding style information to it. For example, you can add images or enhanced text. The following code overrides the default path separator by using an Image control. It also highlights the current path using a light green background color.

<asp:SiteMapPath ID="SiteMapPath2" Font-Name="Garamond" Font-Size="12pt" RunAt="server"> <CurrentNodeStyle Height="24px" BackColor="LightGreen" Font-Bold="true" /> <NodeStyle Height="24px" /> <PathSeparatorTemplate> <ItemTemplate> <asp:Image ID="Image2" ImageUrl="~/images/arrow.gif" RunAt="server" /> </ItemTemplate> </PathSeparatorTemplate> </asp:SiteMapPath>

Figure 7 shows what the SiteMapPath control looks like with the above modification.

Thanks for your registration, follow us on our social networks to keep up-to-date