Return to Snippet

Revision: 48830
at July 11, 2011 06:52 by tabook22


Initial Code
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

Initial URL

                                

Initial Description
this code will show you how to save data from gridview to xml file

Initial Title
Saving data from gridview to xml file

Initial Tags
xml, aspnet

Initial Language
VB.NET