Click here to Skip to main content
15,887,027 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to Export Some colmn data from grid Not All .
For Example : id,name,email,delete,edit (this is grid column)

but I need: Name,Email

NOT All Data.

What I have tried:

Response.Clear();
Response.AddHeader("content-disposition",string.Format
("attachment;filename={0}.xls",fileName));
Response.Charset = "";
Response.ContentType = "application/vnd.xls";
StringWriter stringWrite = new StringWriter();
HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);
GridView1.RenderControl(htmlWrite);
Response.Write(stringWrite.ToString());
Response.End();
Posted
Comments
Maciej Los 5-Feb-19 13:28pm    
And what's wrong with your code?

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