Are you want put confirm on asp button then use this way
<asp:Button ID="Process" runat="server" OnClientClick="return Confirm('Are you sure for process?');" />
Now it ask for confirmation when you click button.
Main Topics
Browse All TopicsHi all,
I have a specific requirement that I just cannot see here in the solutions.
I have an asp.net vb.net application. I have un a sub
Private Sub Close_Register()
// SOME CODE HERE
--------------------
--------------------
// Then I need to send a confirm dialog to user
Dim Answer As String
Answer = MsgBox("The amount is lower then the actual amount. Are you sure you want to close the register?", MsgBoxStyle.Question + MsgBoxStyle.YesNo)
If Answer = vbNo Then Exit Sub
// This works fine on my dev application but when run on the server i get
Error:Showing a modal dialog box or form when the application is not running in UserInteractive mode is not a valid operation. Specify the ServiceNotification or DefaultDesktopOnly style to display a notification from a service application.
Please help
End
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
This is what I was looking for http://forums.asp.net/p/98
In the aspx file:
<input type="hidden" id="Hidden1" name="Hidden1" runat="server">
That adds this to the CodeBehind:
Protected WithEvents Hidden1 As System.Web.UI.HtmlControls
Add some JavaScript:
Dim scriptString As String = "<script language=JavaScript> " + Environment.NewLine
' Store the confirm's return in the hidden control...
scriptString += "document.getElementById('
scriptString += " confirm('Overwrite?');" + Environment.NewLine
' Do a new PostBack...
scriptString += GetPostBackEventReference(
scriptString += "</script>"
RegisterStartupScript("Con
Then in Page_Load:
If IsPostBack AndAlso Request("__EVENTTARGET") = "Hidden1" Then
' Response.Write("Hidden1.Va
If Hidden1.Value = "true" Then
' User answered OK
Else
' User answered Cancel
End If
End If
Hidden1.Value = String.Empty
NC...
Business Accounts
Answer for Membership
by: ajollyPosted on 2009-08-08 at 02:28:01ID: 25048954
VB.Net provides you the option to use MessageBox in development environemtn.
But its not allowed on web server.
ASP.Net does not support MessageBox.
You need to write some script or use ajax scripts or write a user control for that.