Unable to execute Click Event after Importing DataTable to Excel
hi,
i have use code on import datatable excel, when download or cancel download. click event wont run.
how can solve error?
stringwriter writer = null; htmltextwriter writer2 = null; contentbinder ccontentbinder = new contentbinder(); string filename = "usage , role report"; datagrid exportgrid = new datagrid(); datatable dtexcel = new datatable(); //dtexcel = ccontentbinder.createdatatable(); dtexcel = ccontentbinder.getlastlogindate(); exportgrid.datasource = dtexcel; exportgrid.databind(); exportgrid.font.name = "arial"; exportgrid.font.size = new fontunit("9pt"); exportgrid.headerstyle.font.bold = true; exportgrid.headerstyle.font.size = new fontunit("10pt"); exportgrid.headerstyle.backcolor = color.lightgray; exportgrid.bordercolor = color.lightgray; exportgrid.borderwidth = new unit("1"); exportgrid.cellpadding = 1; page.response.clear(); page.response.buffer = true; page.response.contenttype = "application/vnd.ms-excel"; page.response.charset = ""; page.response.addheader("content-disposition", "attachment; filename=" + filename + ".xls"); writer = new stringwriter(); writer2 = new htmltextwriter(writer); exportgrid.rendercontrol(writer2); response.write(writer.tostring()); response.end();
check here see if helpful.
Visual Studio Languages , .NET Framework > Visual C#
Comments
Post a Comment