Hello friends,
when i export data from grid view to excel file.
data successfully export but method throw an exception.
Exception is......
Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack.
Loading

VasanthRank #1,487 · 1.1K reputationPosted Mar 24, 2010, 1:33 AM EDT
Call the HttpContext.Current.ApplicationInstance.CompleteRequest method instead of Response.End to bypass the code execution to the Application_EndRequest event.
If its helps out , please mark as answer
Amit ChoudharyRank #145 · 15.8K reputationPosted Mar 24, 2010, 1:51 AM EDT
Overiding VerifyRenderingInServerForm Method
public override void VerifyRenderingInServerForm(Control control) { /* Confirms that an HtmlForm control is rendered for the specified ASP.NET server control at run time. */}
and your grid will export correctly without any exception i hope.
please mark as answer if it helps.
Jitendra Patel138 reputationPosted Mar 24, 2010, 3:04 AM EDT
please write this in web.config file.
Thanks,
Jitendra Patel
Jitendra Tiwari33 reputationPosted Mar 24, 2010, 3:31 AM EDT
Sanuja Khan14 reputationPosted May 27, 2016, 3:39 AM EDT