asp.net - Button inside updatePanel doesn't works after downloading -
in application have updatepanel few buttons. 1 of button 'export' button - after clicking user can download report local computer.
button created in way:
btnsave = new button { id = "btnsave", causesvalidation = false, text = "save", commandname = commandnames.savetocsv }; controls.add(btnsave); scriptmanager.getcurrent(page).registerpostbackcontrol(btnsave);
and after clicking code executed:
string csv = generatereport(); page.response.clear(); page.response.buffer = true; page.response.contenttype = "text/csv"; page.response.appendheader("content-disposition", "attachment; filename=\"" + filename + "\""); page.response.write(csv); page.response.end();
downloading works corectly in update panel. problem after first click on export button buttons stop works - have page doesn't send server - checked in fiddler (but client javascrpts works correctly). know how resolve problem? maybe there way of downloading data updatepanel (i cannot remove button update panel).
i'm not sure why happens, quick workaround change download button simple href target=_blank, , move csv generation code dedicated page\http-handler
Comments
Post a Comment