| ||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
How to get the confirmation of Yes/No from a javascript pop up
The sample code is on the most frequently asked query on "How to get the confirmation of Yes/No from a javascript pop up and display the value on the page using ASP.NET" The sample code is on the most frequently asked query on "How to get the confirmation of Yes/No from a javascript pop up and display the value on the page using ASP.NET" Create a webpage main.aspx Drag and drop a hidden control and control on the web form. [bold]Step 1. main.aspx.vb[/bold] Write the following code on page load event
Button1.Attributes.Add("onclick", "getMessage()") [bold]Step 2.In main.aspx[/bold] Add the client side-script block <SCRIPT language="javascript"> function getMessage() { var ans; ans=window.confirm('Is it your confirmation.....?'); //alert (ans); if (ans==true) { //alert('Yes'); document.Form1.hdnbox.value='Yes'; } else { //alert('No'); document.Form1.hdnbox.value='No';} } </SCRIPT> [bold]Step 3. main.aspx.vb[/bold] To display the value of the value selected by the user in the pop up write the following code Response.Write(Request.Form("hdnbox")) |
|
#2
|
|||
|
|||
|
what's a hidden control
which tab in the toolbox is it.
a asp.net newbie |
|
#3
|
|||
|
|||
|
Quote:
nevermind, I got it! this article is GREAT! solve a long-standing problem. |
![]() |
| Viewing: ASP Free Forums > Programming > Code Bank > How to get the confirmation of Yes/No from a javascript pop up |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|