message box with OK and CANCEL buttons

How to dreate a Message box with OK and Cancel button. And how to verify which button is pressed

How to add text boxess inside Message box.


thanks and regard



8/13/2007 2:07:42 PM 93655 articles. 3 followers. Follow

3 Replies

Similar Articles

[PageSpeed] 8

I had the same problem myself. It became obvious to me that client side pop-ups, alerts etc... weren't gonna do the job.

 So I used this:

very easy to use and does the job!!

8/13/2007 2:52:04 PM

if a plain javascript alert is what you need, then it is simply:

var res = confirm("Are you sure?");

res is true if user cliked OK and false if they clicked cancel.

if you need to use that to control execution of a postback, you can add as client-side onclick:

return confirm('Are you sure?');

example: <asp:Button OnClientClick=" return confirm('Are you sure?'); " runat="server" ... />



8/13/2007 3:00:30 PM

 Just answered this one for someone else...


Visit my blog
8/13/2007 3:05:41 PM

Similar Artilces:

Load Text box of one web form with selected list item of list box of another web form
one help please Problem is i have two web forms  1.  ForiegnkeyTest.aspx  2. foroginkeytable.aspx   step 1 1 ForiegnkeyTest.aspx one web form <head runat="server"><script language="javascript" type="text/javascript">   function popWin()   {         var confirmWin = null;      confirmWin ='foroginkeytable.aspx','anycontent',   'width=455,height=435,status');   }  </script> &...

Message Boxes and Web Forms
When I go to display a MsgBox(".... in my web form I get an error. Is it possible to display simple pop up messages while working with the web forms?If you don't live for something, you'll DIE for nothing!!!!!! Hi, Message Boxes are not available in You need to write custom javascript functionality for popping up messages. Herebelow is one example:- Response.Write("<script>alert('Hello');</script>") ; Thanks.regards,Harish

OK/Cancel Message box
Hi can anyone please tell me the code to include a Confirm Javascript message box in my VB.NET project...Or can some please point me to a website where i can follow an example Many Thanks Below article has info on CLient side messagebox Thank you...

Cancel Button on Web Form
Hi,How can I set the cancel button so it doesn't cause a postback but a redirect?<asp:TemplateField ShowHeader="False"><InsertItemTemplate><asp:Button ID="Button1" runat="server" CausesValidation="True" CommandName="Insert" Text="Contact Me" />&nbsp;<asp:Button ID="Button2" runat="server" CausesValidation="False" CommandName="Cancel" Text="Clear Form" /></InsertItemTemplate></asp:TemplateField> thanks.  Create an eventhandler for your cancel button and then perform the redirect from the eventhandler method.  IE <asp:Button ID="...

Web Forms Message Box
Hello, I am converting an old VB 6.0 application into a web based app with VB.NET and ASP.NET. The problem that I am having is that the old application made extensive use of popup boxes and message boxes that would ask the user a couple questions and then pass the values back to the main form and close the popup box. I have not been able to find a good way to do this using web forms. Does anyone have any suggestions on this? Thanks Torrey You will have to use vbscript or javascript to display message boxes on the client side. You can use something like this: Button1.Attr...

Web Form : Block the return button on the web form
Hello, I have a principal form with a list of information. From this form, I go on an edit forms and I want to control what is done on this form. For this, I want to block the button Windows back on my edit form. Somebody can help me ? Thank you for your help.  Jy. set the Session Variable (with your ID or whatever ) in the Principal Form when user click on Edit then put the One Back Button on your edit form and Redirect the page by using the Session variable value.Please Mark as Answred If This Blog has Helped You.RegardsMitesh Darjihttp://www.indianic.comhttp://www.mitatdotnet....

Alert Box with OK or Cancel Button
Hi all, I have embed  JavaScript alert function in my asp code. But the alert box will only show the OK button. May I know how to show the option of OK or Cancel button? Thanks My code is as follow:confirmedMsg = "Confirmed Merging ..?"; javaScript += "\n<script language=\"JavaScript\" type=\"text/javascript\">\n";javaScript += "<!--\n"; javaScript += "alert('" + confirmedMsg + "')";javaScript += "// -->\n"; javaScript += "</script>\n"; this.RegisterStartu...

message box in mobile web forms
is there a way to show a messagebox (alert, warning, error), in a mobile web form???...

Cancel and Submit buttons on Web form????
Hi All, I have a Cancel and a Submit buttons in a web form created dynamically from XMl file, seems to me that my Cancel button always is a default button. so when I accidentally hit "enter" key on keyboard, Cancel button is click. Is there a way that I can programatically make Cancel button not a default button Thanks maybe u might check these linke 1- 2- javascript u can set default button using either or javascr...

Implementing .Net Form into an web form, can this be done
I am new here, but have been searching for a while, and may not have the correct lingo to find what I am looking for.  I am tasked with implementing a .exe application that was writen vb6 then converted to .net into a new website my team is developing. The idea is to put each of the 3 different forms in this .exe application of 3 different .aspx pages. I have attempted multiple things to get this into the page and even started to just rewrite it as an web form, but even then I can't reuse any of the code since the System.Web.UI.Page doesn't inherit the sa...

Confirmation Message Box with Replace and Cancel buttons
Hi,   I would like to seek help on how to create a confirmation message with Replace and Cancel buttons.  And also, how can I check if user clicked the Replace button.    Thanks.   Hi, You can create your own Cofirmation msg dialog. u require, div tag, with 2 buttons and text to display. Make this div to display(visible) when u want and allow to user to click any of the button. if clicked 'cancel' set to 'return false;' if clicked 'replace' call respective function() with ur required code in it or set a global var. with value...

web forms validation issue with cancel button
Hello- I have a button in a form that serves as the "cancel" button which takes the user back to the main menu. the problem I have is that on the form there are soem field validators, so even when the user tries to cancel out of the current form they have to select items from the dropdown menus in the form just to cancel. How do i fix this so the user just cancels out of the form and doesnt need to select and fill in text boxes? Thanks set the CausesValidation property of the button to false. You should be able to set the "CausesValidation" property to "fal...

Confirm Message Box with OK or Cancel option in C#
Hi  All, I have a function call which  results in two conditions(True and False).When the condition is false,I wanted the code to display a message box with the two options (OK and Cancel) and when the user clicks the OK button It should direct to another page. Please anyone help me with the code ( in C# ) to display a confirm message box with this two options.Its urgent. Thanks for your help.     private void button3_Click(object sender, System.EventArgs e) { if (MessageBox.Show("Really delete?","Confirm delete", MessageBoxButto...

How to create an message box with only 'OK' button
i want to place a msgbox with OK button to inform the user about his mistake. how can i do it?   thanks in advance Shubhada What's wrong with javascript alert?Leon LangleybenMCSD, ASP.NET MVPBlog how to use it for "OK" button? i know method to 'confirm' from javascript. but how to give an information? Hi, Message box poped up by alert method contains single OK button. What am I missing?Leon LangleybenMCSD, ASP.NET MVPBlog ok.........can u tell what are the different java messagebox methods that we can use in and why the Msgbox function given by

Web resources about - message box with OK and CANCEL buttons -

Message - Wikipedia, the free encyclopedia
A message is a discrete unit of communication intended by the source for consumption by some recipient or group of recipients. A message may ...

"When Chris Wallace asks Bush if he squandered his initial advantage by failing to come up with a 'message' ...
"... which the media cares about more than he does. Instead, Bush wants to talk about how he's 'on the ballot in every state,' which is 'hard' ...

Picture if you will, this message for Trumpie
Picture if you will, this message for Trumpie by digby Via Crooks and Liars: John Amato writes: This broadcast aired on March 4, 1960, but ...

Saudi Executions That Riled Iran Meant as Domestic Message
Saudi Arabia’s execution of 47 men last weekend quickly became an international drama, agitating markets and triggering a flare-up with longtime ...

Mysterious Establishment Millionaire Behind Anti-Trump Messages In The Sky At Rose Bowl Parade
Mysterious Establishment Millionaire Behind Anti-Trump Messages In The Sky At Rose Bowl Parade

Veteran dies hours after posting hopeful New Year's Eve message
Before dying in New Year's crash, victim says "where I windup is where I'm meant to be"

A Message From The Year 2026 About The Future Of Your TV
Thirty years ago, in 1996, you actually used your TV to watch broadcast or cable signals — live, as things aired. Twenty years ago, in 2006, ...

Ted Cruz’ Creepy, Mean-Spirited New Year’s Message For Fox Viewers
While other candidates used their New Year’s Eve airtime on Fox for brief messages of good cheer, Republican presidential candidate Ted Cruz ...

Former NFL Player Shaun Smith Has A Message For Trolls: Look At This Gun
Shaun Smith, a defensive lineman who last played for the Chiefs, rattled off a couple of thoughts today about Kansas City’s upcoming playoff ...

Kristin Cavallari Speaks Out About Brother & Daughter in Bittersweet New Year's Message
See the pic from the former reality star's first date night since her brother's tragic death.

Resources last updated: 1/5/2016 11:43:24 PM