Return to Snippet

Revision: 11679
at February 13, 2009 12:28 by wrburgess


Initial Code
'//////////////////
'/ 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

Initial URL
http://forums.asp.net/p/999571/1327181.aspx

Initial Description

                                

Initial Title
Dropdownlist loaded by XML file in ASP.NET 3.5

Initial Tags
xml, aspnet

Initial Language
ASP