c# - Response processing with ASP.NET functions -
i have function in c# code behind fires on button click. should change span "done", , if zipfile checkbox checked, fire off zip file user.
process.text = "done"; if (zipfile.checked) { response.appendheader("content-disposition", "attachment; filename=" + foldername); response.contenttype = "application/zip"; using (zipfile zip = new zipfile()) { zip.adddirectory(server.mappath("pdfs")+"/"+foldername); zip.save(response.outputstream); } response.end(); }
if checkbox unchecked, done displayed. if zipfile checkbox checked, send zip file, no longer change process.text = done. response seems overwriting asp.net function return. first time using response, doing wrong.
in addition of setting text on server side, set on client side. try following snippet:
<script> function btnprocessclicked() { $('#<%= process.clientid %>').text("done"); return true; } </script>
however, in approach, remember if don't set text on server side in scenario (!zipfile.checked), span revert last server value after postback.
Comments
Post a Comment