Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.0 and 1.1 Professional
|
ASP.NET 1.0 and 1.1 Professional For advanced ASP.NET 1.x coders. Beginning-level questions will be redirected to other forums. NOT for "classic" ASP 3 or the newer ASP.NET 2.0 and 3.5
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 2nd, 2006, 12:36 PM
Authorized User
 
Join Date: Jun 2005
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Default trap Yes or No value from a message box on web pag

on a web page, i have a button, which when clicked, should open a message box with a message "Do you want to save??" and a "Yes" and a "No" button.Once the user selects any one of the two, the message-box should close.
in the click event of the button, i should be able to trap either of the two values selected by the user, as i have to different methods to call, depending on the selection of the user.

Please help.

 
Old February 2nd, 2006, 03:44 PM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default

You need to use the confirm funtion in JavaScript. If the user selects NO, return false and nothing happens. Otherwise your code behind for the button will run.

Jim

 
Old February 2nd, 2006, 03:47 PM
Authorized User
 
Join Date: Jun 2005
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Default

i need to perform something when the user selects No or Cancel, thus i need to trap both the buttons, which is not fulfiled by the confirm function in Javascript

 
Old February 2nd, 2006, 04:16 PM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default

Then you would have to create the popup page with your yes and no button. Then depending on which one is clicked set a session variable (and close the popup with JavaScript). Then access the session variable on the main page.

 
Old February 2nd, 2006, 04:20 PM
Authorized User
 
Join Date: Jun 2005
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Default

but once the popup with the yes and no button is closed, will i return to the click event of the button of the parent page, from where the popup was opened ??

 
Old February 2nd, 2006, 04:29 PM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default

I think it will do a postback on the main page. You might have to check the value there. Just create a simple test page for testing.

 
Old February 2nd, 2006, 04:40 PM
Authorized User
 
Join Date: Jun 2005
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Default

yes, jbenson001 - when the popup closes, a postback on the main page occurs, from where i can continue --- thanks a ton

 
Old February 2nd, 2006, 04:51 PM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default

You are welcome.. glad you have it working now... :)

Jim






Similar Threads
Thread Thread Starter Forum Replies Last Post
Message box basie Classic ASP Basics 1 September 4th, 2008 01:09 PM
problem editing property file in war, from web pag satyavarma EJB 4 March 23rd, 2006 09:32 PM
message box nalla ASP.NET 2.0 Professional 4 December 23rd, 2005 03:00 AM
Dissapear mouse and use key to navigate on web pag karib JSP Basics 0 July 2nd, 2004 12:53 AM
Message Box in Web Appliction NiNe .NET Web Services 1 March 3rd, 2004 09:50 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.