/ Published in: VB.NET
this code will show you how to save data from gridview to xml file
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
Protected Sub GridView1_RowCommand(sender As Object, e As GridViewCommandEventArgs) If e.CommandName = "save" Then Dim st As String = Server.MapPath("emp.xml") Dim ds As New DataSet() ds.ReadXml(st) Dim r As DataRow = ds.Tables(0).NewRow() r(0) = Convert.ToInt32(DirectCast(GridView1.FooterRow.FindControl("TextBox1"), TextBox).Text) r(1) = DirectCast(GridView1.FooterRow.FindControl("TextBox3"), TextBox).Text r(2) = DirectCast(GridView1.FooterRow.FindControl("TextBox5"), TextBox).Text r(3) = Convert.ToInt32(DirectCast(GridView1.FooterRow.FindControl("TextBox7"), TextBox).Text) ds.Tables(0).Rows.Add(r) ds.WriteXml(st) getxml() End If End Sub