Exporting grid view data to pdf
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?
精彩评论