首页 > 代码库 > asp.net 加载xml到menu
asp.net 加载xml到menu
XML File
<?xml version="1.0" encoding="utf-8" ?> <Area iAreaID ="0" cAreaName="城市"> <Province iAreaID ="1" cAreaName="北京市"/> <Province iAreaID ="2" cAreaName="上海市"/> <Province iAreaID ="3" cAreaName="天津市"/> <Province iAreaID ="4" cAreaName="重庆市"/> <Province iAreaID ="5" cAreaName="湖北省"> <City iAreaID ="51" cAreaName="武汉市"/> <City iAreaID ="52" cAreaName="黄冈市" /> <City iAreaID ="53" cAreaName="荆州市"/> <City iAreaID ="54" cAreaName="武穴市" /> <City iAreaID ="55" cAreaName="十堰市"/> <City iAreaID ="56" cAreaName="黄石市" /> </Province> <Province iAreaID ="6" cAreaName="河北省"> <City iAreaID ="61" cAreaName="石家庄市"/> <City iAreaID ="62" cAreaName="唐山市" /> </Province> <Province iAreaID ="7" cAreaName="山西省"> <City iAreaID ="71" cAreaName="太原市" /> <City iAreaID ="72" cAreaName="大同市" /> </Province> </Area>
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default6.aspx.cs" Inherits="Default6" %> <!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></title> </head> <body> <form id="form1" runat="server"> <div> <asp:XmlDataSource ID="XmlDataSource1" runat="server" DataFile="~/Area.xml"></asp:XmlDataSource> <asp:Menu ID="Menu1" runat="server" DataSourceID="XmlDataSource1" Orientation="Horizontal" StaticDisplayLevels="2" StaticEnableDefaultPopOutImage="False"> <DataBindings> <asp:MenuItemBinding DataMember="Area" TextField="cAreaName" ValueField="cAreaName" /> <asp:MenuItemBinding DataMember="Province" TextField="cAreaName" ValueField="cAreaName" /> <asp:MenuItemBinding DataMember="City" TextField="cAreaName" ValueField="cAreaName" /> </DataBindings> </asp:Menu> </div> </form> </body> </html>
asp.net 加载xml到menu
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。