data of datagrid exported to xml file [Resolved]

Posted by Akiii under C# on 3/29/2011 | Points: 10 | Views : 4547 | Status : [Member] | Replies : 5
Scenario is this :-
(1)i have a datagrid filled with values from a database
(2)i have a button in my asp.net page
(3)when i click my button it should export the datas from the datagrid to a xml file ....!

i have done the the first 2 part, now how will i export the values of the datagrid to a xml file when the button is clicked ??

Can anybody help me regarding this ?

thanks
Akiii




Responses

Posted by: T.saravanan on: 3/30/2011 [Member] [MVP] Silver | Points: 50

Up
0
Down

Resolved
Hi,

I saw your attachment, I think you not have access that path in your system.
You can try this...to set a path...
DataSet dt = reg.ExportXML();

// If you using in Local
string sPath = AppDomain.CurrentDomain.BaseDirectory +"output.xml";
// If you using in Server
string sPath = Server.MapPath("output.xml");
dt.WriteXml(sPath);



Thanks,
T.Saravanan

Akiii, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: T.saravanan on: 3/29/2011 [Member] [MVP] Silver | Points: 25

Up
0
Down
Hi,

Refer this link....http://forums.asp.net/t/1469398.aspx/2/10?Create+XML+file+Dynamically+Using+ASP+Net+C+On+Server

Thanks,
T.Saravanan

Akiii, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Akiii on: 3/29/2011 [Member] Bronze | Points: 25

Up
0
Down
thank you sir for the reply.....
I tried that but couldnt export the value of the datagrid to xml file.....

how can i bind the values of the datagrid to xml functions??

thanks
Akiii

Akiii, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Akiii on: 3/29/2011 [Member] Bronze | Points: 25

Up
0
Down
while i am writing the xml file, its giving me unauthorized access exception...

why is this coming?
i am attaching a screenshot of the above.......please have a look!

Thanks and Regards
Akiii
 Download source file

Akiii, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Akiii on: 3/30/2011 [Member] Bronze | Points: 25

Up
0
Down
Thank you very much Sir, the above code that u posted is working absolutely fine...

i have used the local path...

Thank you for your help...
Akiii

Akiii, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response