Click here to Skip to main content
15,889,760 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
Can anyone help me.With the code.I want to load the data from grid view to XML file,on button Click.
I am not using code to connect grid view But i am,Using Sqldatasource.Please Help me with this issue.

With Regards

NanKi
Posted

 
Share this answer
 
hi,
First by using this
DataSet dsgv = dataGridView1.DataSource.ToString();
convert gridview data into dataset.
After use GetXml method of dataset so that you will get xml of gridview's data.
like dsgv.Getxml
Hope you will get..
 
Share this answer
 
Hai Nanki,
Just go through this link and i think you'll get what you need.
<a href="http://csharpdotnetfreak.blogspot.com/2011/10/export-gridview-to-excel.html">http://csharpdotnetfreak.blogspot.com/2011/10/export-gridview-to-excel.html</a>[<a href="http://csharpdotnetfreak.blogspot.com/2011/10/export-gridview-to-excel.html" target="_blank" title="New Window">^</a>]
 
Share this answer
 
Comments
Nandakishore G N 28-Jan-12 1:19am    
Thanks....Arun...but,I requested For Loading From Gridview to XML not (excel)...
Sorry Dude,
I think you are using DataSet for Binding to the gridview.Now there is a way of converting this DataSet to XML File.Please Refer
<a href="http://quickstart.developerfusion.co.uk/quickstart/howto/doc/Xml/SaveDataSetXML.aspx">http://quickstart.developerfusion.co.uk/quickstart/howto/doc/Xml/SaveDataSetXML.aspx</a>[<a href="http://quickstart.developerfusion.co.uk/quickstart/howto/doc/Xml/SaveDataSetXML.aspx" target="_blank" title="New Window">^</a>]
 
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