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?
mohd sajidPosted Apr 18, 2013, 5:44 AM
Satyapriya NayakPosted Apr 18, 2013, 5:34 AM
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();
}