Get the value of confirmation-confirmation using a code-code in C #

I want to get the value from the side to confirm aspx

bool type=false;

 type=   ClientScript.RegisterStartupScript(typeof(Page), "exampleScript", "confirm('are you confirm?')", true);

if(type){
...
}

How do I get the value?

0
source share
3 answers

It doesn't seem like a better approach (I mean, you can display a pop-up client application) ... However, if you want to execute this ...

You have a hidden asp button: on your aspx and attach an event handler to it and write the code that you want to execute by clicking the "Yes" button on the confirmation button.

And change your RegisterStartupScript below

type=   ClientScript.RegisterStartupScript(typeof(Page), "exampleScript", "if(confirm('are you confirm?')) { document.getElementById('btn').click(); } ", true);
+1
source
bool type=false;

  "return confirm('are you confirm?')"

if(type){
...
}
0
source

. .

ClientScript.RegisterStartupScript(typeof(Page), "exampleScript", "if(confirm(\"Are you sure?\")){ document.getElementById('Button1').click(); }", true);
<asp:Button ID="Button1" Visible="true" SkinID="button"  OnClick="Button1_Click"  runat="server" />

hidden button . : visible="false" . style="display:none"

0

All Articles