//Method to read XML File and feel out
dropdownlist
public void GetAllLocations()
{
DataSet ds = new DataSet();
ds.ReadXml(Server.MapPath("~\\App_Data\\Location.xml"));
try
{
if (ds.Tables[0].Rows.Count > 0)
{
DDLLocation.Enabled = true;
DDLLocation.DataSource = ds;
DDLLocation.DataTextField = "LocationName";
DDLLocation.DataValueField = "LocationName";
DDLLocation.DataBind();
DDLLocation.Items.Insert(0, new ListItem("(Please Select)", Convert.ToString(0)));
}
else
{
DDLLocation.Items.Insert(0, new ListItem("Location not found", Convert.ToString(0)));
return;
}
}
catch (Exception ex)
{
lblMessage.Text = "Load Location... " + ex.Message.ToString();
return;
}
}