ASP Free.com How to get the confirmation of Yes/No from a javascript pop-up and display

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 <asp:button> control on the web form.Step 1. main.aspx.vbWrite the following code on page load event< ...

Contributed by
Rating: 4 stars4 stars4 stars4 stars4 stars / 22
March 18, 2003
Rate this Article:
MEH MEH++


SEARCH ASP FREE
TOOLS YOU CAN USE

advertisement
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 <asp:button> control on the web form.

Step 1. main.aspx.vb

Write the following code on page load event

Button1.Attributes.Add("onclick", "getMessage()")

Step 2.In main.aspx

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>

Step 3. main.aspx.vb

To display the value of the value selected by the user in the pop up write the following code

Response.Write(Request.Form("hdnbox"))

blog comments powered by Disqus
ASP.NET CODE ARTICLES

- How to Use the ListBox Control in ASP.NET 2.0
- How to Load XML Documents in ASP.NET 2.0
- DataGrid Code
- ASP.NET Guestbook
- User Controls and Client Side Scripting
- ASP.NET Programming with Microsoft's AS...
- ASP.NET Basics (part 3): Hard Choices
- ASP.NET Basics (part 2): Not My Type
- ASP.NET Basics (part 1): Nothing But .Net
- Directory Tree Browser
- How to get the confirmation of Yes/No from a...
- Complete example using custom errors and wri...
- Paging Certain # records per page .NET style
- General Methods of formatting and Subtractin...
- .NET LinkButton web control

ASP Web Hosting ASP.Net Web Hosting Windows Web Hosting
 
 
 

ASP Free Forums 
 RSS  Tutorials RSS
 RSS  Forums RSS
 RSS  All Feeds
Site Map 
Request Media Kit
Write For Us Get Paid 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Privacy Policy 
Support 


© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 2 - Follow our Sitemap
Most Popular Topics
All ASP.Net Tutorials