javascript - C# confirm() Function Browser Refresh Issue -


i have c# program, uses javascript confirm() function create yes/no alert.

the issue i'm having is:

  1. i click "yes" on pop-up , program executes.
  2. now, when refresh browser, "confirm form re-submission" message appears, , if click on "continue" same yes/non pop-up appears again, instead of reloading page. , i'm forced select yes or no again.

confirm re-submission popup

javascript:

function confirm()         {             var confirm_value = document.createelement("input");             confirm_value.type = "hidden";             confirm_value.name = "confirm_value";             if (confirm("are sure want continue?"))             {                 confirm_value.value = "yes";             }             else             {                 confirm_value.value = "no";             }             document.forms[0].appendchild(confirm_value);         } 

c#:

public void onconfirm(object sender, eventargs e)         {                 try                 {                     string confirmvalue = request.form["confirm_value"];                     if (confirmvalue == "yes")                     {                         this.page.clientscript.registerstartupscript(this.gettype(), "alert", "alert('you selected yes.')", true);                     }                     else                     {                         this.page.clientscript.registerstartupscript(this.gettype(), "alert", "alert('you selected no.')", true);                     }                 }                 catch (exception ex)                 {                     exceptionlabel.text = (ex.message);                 }                    } 


Comments

Popular posts from this blog

How to understand 2 main() functions after using uftrace to profile the C++ program? -

c# - Update a combobox from a presenter (MVP) -

How to put a lock and transaction on table using spring 4 or above using jdbcTemplate and annotations like @Transactional? -