Using XML as a data source, let the Asp:menu class freely extend a menu item

Source: Internet
Author: User
Tags add extend xpath

Create a new XML file named menu with the following contents:








Then drag and drop a menu control on the page and drop a XmlDataSource control with the ID XmlDataSource1 to set the menu's DataSourceID to XmlDataSource1.

Configure the XmlDataSource control to make the datafile= "~/menu.xml" xpath= "Menu/menuitem", where XPath is used to select the data to filter out the MenuItem data.

At this point, the data for the menu control is then bound, telling the menu control how to display the data filtered from the XML file. Select the Menu control, select DataBindings in the Properties window, in the pop-up dialog box, select MenuItem in the upper-left list, click the Add button to add MenuItem to the lower-left list, and then choose MenuItem in this list, This is the list on the right that will display the property to bind so that navigateurlfield= "url" textfield= "title". Press the OK button to return to the design interface, which will show "home" and "news" two menu items.
  
Design the HTML code as follows:

<%@ Page language= "C #" autoeventwireup= "true" codebehind= "Default.aspx.cs" inherits= "Coaffiliate._default"%>



untitled page















Http://www.cnblogs.com/ofei/archive/2007/01/20/625745.html



Related Article

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.