xml file content:
Xml binding to gridview
I serialized the dataset to xml file in BLL i.e Middle tier,I have this xml file.Now i want to attach this xml file to gridview without using dataset.HOW?
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Satyapriya NayakRank #47 · 31.5K reputationPosted Apr 18, 2013, 1:34 AM EDT
protected void btn_showdata_Click(object sender, EventArgs e)
{
string filePath = Server.MapPath("Data1.xml");
//Table Must match with the element name in your file
DataTable dt = new DataTable("Table");
//Add Columns in datatable
//Column names must match XML File nodes
dt.Columns.Add("CustomerTypeID", typeof(System.String));
dt.Columns.Add("CustomerTypeCode", typeof(System.String));
dt.Columns.Add("CustomerType", typeof(System.String));
dt.Columns.Add("TransactionLimit", typeof(System.String));
//Read XML File And Display Data in GridView
dt.ReadXml(filePath);
GridView1.DataSource = dt;
GridView1.DataBind();
}
mohd sajid8 reputationPosted Apr 18, 2013, 1:44 AM EDT