Steps:
1. xml file. Here we use the XML document: slivermenu. XML to describe the specific menu content. For example
<? XML version = "1.0" encoding = "UTF-8"?>
<Items>
<Menuitem navigateurl = "http // DOTNET. X. CC/" text = "">
<Menuitem navigateurl = "http // DOTNET. X. CC/showlist. X? Id = 1 "text =" News notification ">
<Menuitem navigateurl = "classical. X" text = "News 1"/>
<Menuitem navigateurl = "Rock. X" text = "News 2">
<Menuitem navigateurl = "classical. X" text = "Latest news 2.1"/>
<Menuitem navigateurl = "classical. X" text = "Latest news 2.2"/>
</Menuitem>
</Menuitem>
<Menuitem navigateurl = "movies. X" text = "subject Introduction">
<Menuitem navigateurl = "Action. X" text = "Notification 1"/>
<Menuitem navigateurl = "drama. X" text = "Notice 2"/>
<Menuitem navigateurl = "musical. X" text = "Notice 3"/>
</Menuitem>
<Menuitem navigateurl = "" text = "">
</Menuitem>
<Menuitem navigateurl = "" text = "">
</Menuitem>
<Menuitem navigateurl = "" text = "">
</Menuitem>
<Menuitem navigateurl = "" text = "">
</Menuitem>
<Menuitem navigateurl = "" text = "">
</Menuitem>
<Menuitem navigateurl = "" text = "">
</Menuitem>
<Menuitem navigateurl = "" text = "Download column">
</Menuitem>
<Menuitem navigateurl = "" text = "BBS">
</Menuitem>
</Menuitem>
</Items>
2. Add the xmldatasource control and configure the Data source: slivermenu. xml.
3. Add the menu control. Configure the data source xmlperformance1.
4. Data Binding. On the Properties panel of menu1, select databinding, click menuitem, and add it to "selected data binding". In the data binding dialog box on the right, select textfield and navigatrurlfield. Click "OK ".
5. On the menu control properties panel, select orientation: horizontal.
OK. The Code is as follows:
<% @ Page Language = "C #" autoeventwireup = "true" codefile = "slivermenu. aspx. cs" inherits = "slivermenu" %>
<! Doctype HTML public "-// W3C // dtd xhtml 1.0 transitional // en" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<HTML xmlns = "http://www.w3.org/1999/xhtml">
<Head runat = "server">
<Title> slivermenu </title>
</Head>
<Body>
<Form ID = "form1" runat = "server">
& Nbsp;
<Asp: xmldatasource id = "xmlperformance1" runat = "server" datafile = "~ /App_data/staticmenu. xml"
XPath = "items/menuitem" ontransforming = "xmlperformance=transforming"> </ASP: xmldatasource>
<Asp: menu id = "menu1" runat = "server" performanceid = "xmlperformance1" dynamichorizontaloffset = "17"
Font-bold = "true" font-size = "small" maximumdynamicdisplaylevels = "2" orientation = "horizontal"
Staticdisplaylevels = "2" style = "position: relative">
<Databindings>
<Asp: menuitembinding datamember = "menuitem" navigateurlfield = "navigateurl" textfield = "text"/>
</Databindings>
</ASP: menu>
</Form>
</Body>
</Html>