[WebMethod] [System.Web.Script.Services.ScriptMethod(ResponseFormat = System.Web.Script.Services.ResponseFormat.Json)] public void ExportToExcel(FormFieldsInfo objFF) { try { //FormBuilderDataProvider.ExportToExcel(objFF); HttpContext.Current.Response.Clear(); HttpContext.Current.Response.ClearContent(); HttpContext.Current.Response.ClearHeaders(); HttpContext.Current.Response.AddHeader("content-disposition", "attachment;filename=" + objFF.FieldName + "_" + DateTime.Now.ToString("M_dd_yyyy_H_M_s") + ".xls"); HttpContext.Current.Response.ContentType = "text/xls"; HttpContext.Current.Response.Write(objFF.FieldHtml); HttpContext.Current.Response.Flush(); HttpContext.Current.Response.End(); //HttpContext.Current.ApplicationInstance.CompleteRequest(); } catch (Exception ex) { throw ex; } }
GetFormReport: function(fileName) { var html = '<table><tr><th>Name</th><th>Age</th></tr><tr><td>shyam</td><td>27</td></tr><tr><td>sujan</td><td>30</td></tr><tr><td>dhrub</td><td>25</td></tr></table>'; var tableContent = { FormFieldsInfo: { FieldHtml: html, FieldName: fileName } } this.config.method = "ExportToExcel"; this.config.url = this.config.baseURL + this.config.method; this.config.data = JSON2.stringify({ "objFF": tableContent.FormFieldsInfo }); this.config.ajaxCallMode = 4; this.ajaxCall(this.config); }
Response.End
HttpContext.Current.ApplicationInstance.CompleteRequest
Response.Redirect ("Paganame.aspx", false);
Server.Transfer
Server.Execute
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)