Click here to Skip to main content
15,885,216 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi Guys can you please help. I am trying to create an xml from the data in the GridView, below is the code that I have for populating the GridView
C#
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

       Dim dt As New DataTable()
       Dim strConnString As String = System.Configuration.ConfigurationManager.ConnectionStrings("ApplicationServices").ConnectionString
       Dim strQuery As String = "select * from Customer_Details"
       Dim cmd As New SqlCommand(strQuery)
       Dim con As New SqlConnection(strConnString)
       Dim sda As New SqlDataAdapter()
       cmd.CommandType = CommandType.Text
       cmd.Connection = con
       Try
           con.Open()
           sda.SelectCommand = cmd
           sda.Fill(dt)
           Me.GridView1.DataSource = dt
           Me.GridView1.DataBind()
       Catch ex As Exception
           Response.Write(ex.Message)
       Finally
           con.Close()
           sda.Dispose()
           con.Dispose()
           dt.Dispose()
       End Try

   End Sub
Posted
Updated 20-Aug-14 23:56pm
v2

1 solution

Check this links

35215-aspnet-c%23-export-gridview-to-xml/[^]


Hope it will help
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900