Click here to Skip to main content
15,892,927 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi,

When i export griddata to excel at that time some column values need to uneditable.
how can i do it??


My code for export is below,

grdExport.DataSource = ds.Tables[0];
grdExport.DataBind();


Response.ClearContent();
Response.ContentType = "application/excel";
Response.AddHeader("content-disposition", "attachment; filename=out.xls");
StringWriter sw = new StringWriter();
HtmlTextWriter htw = new HtmlTextWriter(sw);
grdExport.RenderControl(htw);
Response.Write(sw.ToString());
Response.Flush();
Response.End();
Posted
Updated 19-Oct-14 20:23pm
v3

1 solution

 
Share this answer
 
Comments
sankmahesh 20-Oct-14 3:01am    
i need to lock particular column only
Mehdi Gholam 20-Oct-14 3:06am    
Excel does not have this ability.
sankmahesh 20-Oct-14 3:17am    
then how can i export and lock. any application have this ability

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