place.xml
--------------
<?xml version="1.0" encoding="utf-8" ?>
<Places>
<Place>
<Id> 1 </Id>
<City>Chennai</City>
<Country>INDIA </Country>
</Place>
<Place>
<Id> 2 </Id>
<City> Atlanta </City>
<Country>USA </Country>
</Place>
</Places>
In Codebehind of the page,place this code
------------------------------------------
protected void Page_Load(object sender, EventArgs e)
{
DataSet DS = new DataSet();
DS.ReadXml(Server.MapPath("~/place.xml"));
DropDownList1.DataTextField = "City";
DropDownList1.DataValueField = "Id";
DropDownList1.DataSource = DS;
DropDownList1.DataBind();
}
0 comments:
Post a Comment