Use xml as the data source, and use asp: Menu class to freely expand Menu items

Source: Internet
Author: User
First, create an xml file named menu with the following content: First, create an xml file named menu with the following content:

 
   
    
            
 

Then, 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, which filters out 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.
The html code is as follows:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="CoAffiliate._Default" %>    Untitled Page    

The above is the use of xml as the data source, with asp: Menu class free expansion Menu item content, more relevant content please follow PHP Chinese network (www.php1.cn )!

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.