c# - How to export excel from clicking chart legend? -


i have created few charts dynamically , export data excel using closedxml. created custom item on legend , when click it, page posts , event handler raised properly. couldn't save window pop up, hence not being able save excel file. me please?

i using c# on asp.net framework 4.5.

here's simplified version of code.

protected void page_load(object sender, eventargs e) {     add_chart(); }  public void add_chart() {     system.web.ui.datavisualization.charting.chart add_chart1 = new system.web.ui.datavisualization.charting.chart();     //create chart here     //add chart htmltablecell      add_chart1.click += chart_legend_click; }  protected void chart_button_click(object sender, imagemapeventargs e) {     string sheetname = "trial";     string filename = "trial.xlsx";     var workbook = new xlworkbook();     var worksheet = workbook.worksheets.add(sheetname);      httpresponse httpresponse = response;     httpresponse.clear();     httpresponse.contenttype = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";     httpresponse.addheader("content-disposition", "attachment;filename=" + filename);      //create header , data rows here      using (system.io.memorystream memorystream = new system.io.memorystream())     {         workbook.saveas(memorystream);         memorystream.writeto(httpresponse.outputstream);         memorystream.close();     }     httpresponse.end(); } 


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -