Interview Questions → ASP.NET → ASP.NET Questionnaire III
ASP.NET Questionnaire III
string xmlString = "<root><country><id>1</id><name>India</name></country><country><id>2</id><name>Australia</name></country><country><id>3</id><name>Srilanka</name></country></root>";
using (XmlReader reader = XmlReader.Create(new StringReader(xmlString)))
{
DataSet ds = new DataSet();
ds.ReadXml(reader);
if (ds != null)
{
if (ds.Tables.Count > 0)
{
DropDownList1.DataSource = ds.Tables[0];
DropDownList1.DataValueField = "ID";
DropDownList1.DataTextField = "name";
DropDownList1.DataBind();
}
}
}
<customErrors redirectMode="ResponseRewrite" mode="On" defaultRedirect="error_page"></customErrors>