Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Confirmation Box in ASP.net 1

Status
Not open for further replies.

nwt002

MIS
Jun 16, 2005
58
US
Hello all,
I am working on my first asp.net application and am using Visual Studio 2005 to create a web application. I resently found out that the msgbox cannot be used in a web application because it runs on the server-side. I've searched for some sort of equivalent for asp.net and found a lot of sample code for using javascript or vbscript to display a confirm msg on a button click, but no information on how to make it communicate with the aspx code.

I currently have a database of people, which have "cases".
When adding a new person to the database the following occurs:

Code:
Protected Sub btnTEST_Click(ByVal...)  =
   Code to check if user already exist in database...
   [blue]If User does not exist then[/blue]
            code to add user and "case" information to db...
   [blue]elseIf user does exist then[/blue]
            display [red][b]msgbox"User already exist, do you want to add new case to users profile."[/b][/red] (yes/no msgbox)
               [green]If yes then[/green]
                   code to add users case information...
               [green]elseIf No then[/green]
                   stop process additional aspx code
               [green]end if[/green]
   [blue]end if[/blue]
end sub

All of my aspx code works, but what I need to do is replace the message box above, with an alternative popup(javascript, etc.) that will stop the aspx code from processing until I have selected an option, and then pass the selected option back to the aspx code so it will know what to do next. Does anyone have any information about how I can go about doing this. Thanks for the help.
 
if you want a confirmation box this needs to be done on the client using js before the request is sent. Not on the server using vb.

Jason Meckley
Programmer
Specialty Bakers, Inc.
 
Thanks for replying, Jason. Is it possible, in the vb code, to replace the msgbox with code that would generate js that would display a confirmation box and wait until an option is selected before continueing with the vb code. Then once Yes or No is selected, the information would be passed back to the server, so that it will know what vb code to perform next. I'm not sure if this functionality is even possible, but I saw in some forums where you can use the OnClientClick property of a button to generate a js confirmation box, and it wait until an option is select to finish running the vb code, but I would like this functionality in the middle of the vb code.

I also read some things online that mention stuff about AJAX, but I tried installing it and got some errors when trying to use the Control Tool Kit. If I can't get the result that I want with js, would AJAX work for this? If not, does anyone have any suggestions on how I could get this to work this way? Thanks.
 
no you can't "pause" server code and wait for a clients response. with web development the workflow is:
1. client requests URI
2. server receives request
3. server processes request
4. server sends response to request
5. client receives response
6. client processes response.
7. transaction complete

ajax still follows the process above. the only difference is the browser doesn't need to completely referesh the entire page.

I recommend research how HTTP request/response works. This may help you solve your current workflow problem. once you know that, then research the asp.net life cycle. this abstracts/complicates the request/response pipeline.

Jason Meckley
Programmer
Specialty Bakers, Inc.
 
Ok. I'll look some information up on what you have mentioned. Thanks! I appreciate the help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top