For ASP tool bar, XML is used as the data source, and the menu item can be freely expanded with ASP: Menu

Source: Internet
Author: User

First, create an XML file named menu with the following content:

 
<? XML version = "1.0" encoding = "UTF-8"?> <Menu> <menuitem url = "~ /Default. aspx "Title =" Homepage "Description =" "/> <menuitem url = "~ /News. aspx "Title =" news "Description =" "> <menuitem url = "~ /News. aspx "Title =" domestic news "Description =" "/> <menuitem url = "~ /News. aspx "Title =" International News "Description =" "/> </menuitem> </menu>

drag and drop a menu control on the page, and drag and drop an xmldatasource control. The ID is xmlperformance1, And the menu performanceid is set to xmlperformance1. Configure the xmldatasource control to make datafile = "~ /Menu. xml "XPath =" menu/menuitem ". Here, we use XPath to select data and filter the menuitem data. Then, bind the data of the menu control to tell the menu control how to display the data filtered out from the XML file. Select the menu control and databindings in the Properties window. In the displayed dialog box, select menuitem in the list in the upper left corner and click Add to add menuitem to the list in the lower left corner, then select menuitem in this list. The right List displays the attributes to be bound so that navigateurlfield = "url" textfield = "title ". Press the OK button to return to the design interface. The "Homepage" and "news" menu items are displayed. Design the HTML Code as follows:

<% @ Page Language = "C #" autoeventwireup = "true" codebehind = "default. aspx. cs" inherits = "coaffiliate. _ default" %> <! 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"> 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.