Dec 05, 2008, 8:00 AM
[CLOSED] Error
hi,
i got the Exception when i click the button. the Error is unable to evaluate expression because the code is optimized or a native frame is on top of the call stack.
i got the Exception when i click the button. the Error is unable to evaluate expression because the code is optimized or a native frame is on top of the call stack.
<asp:ImageButton ID="ImageButton1" ImageUrl="~/images/toolbar/excel.png" runat="server" OnClientClick="GridPanel1.submitData(); return false;" /></p>
protected void SubmitData(object sender, StoreSubmitDataEventArgs e) </p>
{ </p>
</p>
</p>XmlNode xml = e.Xml;
</p>
DataSet ds = new DataSet();</p>
</p>
ds.ReadXml(new XmlNodeReader(xml));</p>
string attachment = "attachment; filename=Contacts.xls";</p>
Response.ClearContent();</p>
Response.AddHeader("content-disposition", attachment);</p>
Response.ContentType = "application/vnd.xls";</p>
StringWriter sw = new StringWriter();</p>
HtmlTextWriter htw = new HtmlTextWriter(sw);</p>
System.Web.UI.WebControls.GridView dg = new System.Web.UI.WebControls.GridView();</p>
dg.DataSource = ds.Tables[0];</p>
dg.DataBind();</p>
dg.RenderControl(htw);</p>
Response.Write(sw.ToString());</p>
Response.End();</p>
</p>
</p>
</p>
}</p>
</p>