/ Published in: ASP
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
'////////////////// '/ The DropDownList '////////////// <asp:DropDownList ID="DropDownList1" runat="server" DataTextField="ddlText" DataValueField="ddlValue" /> '////////////////// '/ The Xml '////////////// <?xml version="1.0" encoding="utf-8" ?> <Items> <Item ddlValue ="1" ddlText="YourlistItem1" /> <Item ddlValue ="2" ddlText="YourlistItem2" /> <Item ddlValue ="3" ddlText="YourlistItem3" /> </Items> '////////////////// '/ VB Code Behind '////////////// Imports System.Xml Imports System.Data LoadDropDownList(ddlist As object) Dim ddlDataSource As New DataSet ddlDataSource.ReadXml(MapPath("XmlFile.xml")) ddlist.DataSource = ddlDataSource ddlist.DataBind() End Sub
URL: http://forums.asp.net/p/999571/1327181.aspx