开发者

Exporting grid view data to pdf

开发者 https://www.devze.com 2023-02-25 00:42 出处:网络
I want to export the data from gridviewto pdf, I have got the error like this while exporting Exception Details: System.InvalidOperationException: RegisterForEventValidation can only be called durin

I want to export the data from gridview to pdf, I have got the error like this while exporting

Exception Details: System.InvalidOperationException: RegisterForEventValidation can only be called during Render();

And this is my code

GridView1.AllowPaging = false;
GridView1.DataBind();  
GridView1.RenderControl(tx);
GridView1.HeaderRow.Style.Add("width", "15%"); 
GridView1.HeaderRow.Style.Add("font-size", "10px");

it was showing error at Gridview1.Rend开发者_如何转开发erConrol(tx). tx is coming from this statement:

HtmlTextWriter tx = new HtmlTextWriter(sw);

can any one help me

many thanks


You're modifying the control AFTER it was rendered. Could this be what is firing this "RegisterForEventValidation" event?

0

精彩评论

暂无评论...
验证码 换一张
取 消