asp.net - Return value of ScriptManager.RegisterStartupScript confirm box in code behind -


there 2 confirm boxes on imagebutton - first 1 regular 1 saying "are sure want delete it?" (that onclientclick event on client side ). if 'yes' selected, goes server side code, check happens , if check true, second confirm box displayed code behind using scriptmanager.registerstartupscript.

page page = httpcontext.current.currenthandler page; string script = "alert('there agents associated group. sure want delete group?')"; scriptmanager.registerstartupscript(page, page.gettype(), "its working", script, true); 

my question is, how can know value of second confirm box (which generated in code behind) because respect answer have delete record.

any suggestions?

after user confirms delete (the 2nd time), need make second round-trip server pass value server-side.

on form, can add hidden field hold result of second confirm. if hidden field named "confirmdelete", change startup script this:

1) on page, add javascript function prompt user, response, put hidden field , submit again:

<script language="javascript"> function checkconfirm() {    var conf = window.prompt('there agents associated group. sure want delete group?');    document.forms[0].confirmdelete.value = conf; //or equiv in jquery    document.forms[0].submit();  //or equiv in jquery } </script> <!-- don't forget have hidden field inside of form --> <input type="hidden" name="confirmdelete" /> 

2) change startup script call (above) js function:

page page = httpcontext.current.currenthandler page; string script = "checkconfirm()"; scriptmanager.registerstartupscript(page, page.gettype(), "its working", script, true); 

Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -