dcsimg
Login | Register   
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.


Tip of the Day
Language: C#
Expertise: Intermediate
Jul 12, 2005

WEBINAR:

On-Demand

Application Security Testing: An Integral Part of DevOps


Export Data Grid Content to an XML File

Assume that your Data Grid is not associated with any dataset. In the absence of any XML support functions, you can use the RenderControl method to extract the content into an .xml file.

The following code explains:


         ArrayList al = new ArrayList();
         for(int i=0;i<=10;i++)
         {
            al.Add(i+"");
         }
         DataGrid1.DataSource=al;
         DataGrid1.DataBind();
         Response.Clear();
Response.AddHeader("content-disposition","fileattachment;filename=test.xml");
         Response.ContentType="text/xml";
         
         StringWriter sw = new StringWriter();
         HtmlTextWriter hw = new  HtmlTextWriter(sw);
         DataGrid1.RenderControl(hw);
         Response.Write(sw.ToString());
         Response.End();
Jaya Nehru Kumar
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
×
We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.
Thanks for your registration, follow us on our social networks to keep up-to-date