ayha1999
asked on
Confirmation window
Hi,
How can I popup a confirmation window in the following buton click event?
Private Sub Button1(byVal Sender as object, e as DatagridcommandeventARgs)h andles Button1.Click
...
dim Total as integer = cmd.ExecuteScalar
if Total > 5 then
...I want popup a conf. window here showing the value 5 inthe window.
end if
' If user clicks OK then I want to execute the rest of the code otherwise just cancel the execution.
...
the rest of the code like
ExecuteNonQuery
...
End Sub
Ayha1999
How can I popup a confirmation window in the following buton click event?
Private Sub Button1(byVal Sender as object, e as DatagridcommandeventARgs)h
...
dim Total as integer = cmd.ExecuteScalar
if Total > 5 then
...I want popup a conf. window here showing the value 5 inthe window.
end if
' If user clicks OK then I want to execute the rest of the code otherwise just cancel the execution.
...
the rest of the code like
ExecuteNonQuery
...
End Sub
Ayha1999
ASKER
Hi,
How can display the 'Total' in the following statement? is tbe it stop the execution of the rest of the code if user click 'cancel'?
Response.Write( "return confirm('Are you sure you want to delete this record? The delete cannot be undone!'); ")
ayha
How can display the 'Total' in the following statement? is tbe it stop the execution of the rest of the code if user click 'cancel'?
Response.Write( "return confirm('Are you sure you want to delete this record? The delete cannot be undone!'); ")
ayha
To allow cancel, set the 'onClick' attribute like this:
Me.Button1.Attributes("onC lick") = "javascript:return confirm('Are you sure you want to delete this record? The delete cannot be undone!');"
If you click 'Yes', it will post back, and if you click cancel, it won't.
Bob
Me.Button1.Attributes("onC
If you click 'Yes', it will post back, and if you click cancel, it won't.
Bob
ASKER
HI,
I tried the sample but it doesn't fullfil my requirement. could u pls tell me how to use the sample provided in follwoing link with the follwoing sample?
http://www.codeproject.com/aspnet/NingLiangSimpleControl.asp
if Total > 5 then
...I want popup ther confirmation window here showing the value 5 inthe window. and if use clicks OK the process the rest of the code other stop processing.
end if
thanks in advance.
ayha
I tried the sample but it doesn't fullfil my requirement. could u pls tell me how to use the sample provided in follwoing link with the follwoing sample?
http://www.codeproject.com/aspnet/NingLiangSimpleControl.asp
if Total > 5 then
...I want popup ther confirmation window here showing the value 5 inthe window. and if use clicks OK the process the rest of the code other stop processing.
end if
thanks in advance.
ayha
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Adding JavaScript Confirm Delete Dialog to ASP Pages
http://www.gotocode.com/art.asp?art_id=78&
Response.Write( "<SCRIPT Language='JavaScript'>")
Response.Write( "if (document.forms['" & formName & "'])" )
Response.Write( "document." & formName & ".onsubmit=delconf;" )
Response.Write( "function delconf() {" )
Response.Write( "if (document." & formName & ".FormAction.value == 'delete')" )
Response.Write( "return confirm('Are you sure you want to delete this record? The delete cannot be undone!'); ")
Response.Write( "}")
Response.Write( "</SCRIPT>")
Notice the use of the 'confirm' Javascript function.
Bob