Re: Javascript Confirm()
- From: "Thomas Holloway" <holloway.thomas@xxxxxxxxx>
- Date: Wed, 20 Dec 2006 16:22:49 -0700
No doubt you will have to store these in a hidden field if you don't want to use a lot of Ajax here. As you said you don't want to attach this to a button. So here's an example of handling a return value such as in confirm(message), and using those values in server side code.
http://www.codeproject.com/aspnet/ClientServerInteraction.asp
"shil" <joshilat@xxxxxxxxx> wrote in message news:1166639638.553741.107430@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hi all,
Can any one direct me in how to use javascript confirm() function when
a condition is met from codebehind. I don't want to attach this to a
button. When I submit the page, I want to check some business rules,
and based on the response from the database, if the response is Yes, I
need to display a confirmation alert to user. When the user clicks ok,
then I should take an action, if not, exit out of the subroutine.
Below is the script I'm using in the Submit_Click() subroutine.
If Trim(Message) <> "" Then
Dim strScript As String = "<script
language=JavaScript>"
strScript += "confirm(""" & Trim(Message) &
""");"
strScript += "</script>"
If (Not
Page.IsStartupScriptRegistered("clientScript")) Then
Page.RegisterStartupScript("clientScript",
strScript)
End If
End If
In the above code, I'm getting a message from the Sql database into
Message variable, and showing that to the user.
But I don't have a way to track what an user have selected from the
confirmation alert box.
Any help is appreciated.
Thanks.
.
- References:
- Javascript Confirm()
- From: shil
- Javascript Confirm()
- Prev by Date: SQL 2000 & ASP.NET/Visual Studio 2005
- Next by Date: slow vs 2005
- Previous by thread: Re: Javascript Confirm()
- Next by thread: Re: For Microsoft Partners and Customers Who Can't Download or Access MSDN2...
- Index(es):