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?


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.RegisterStartupScript("AlertScript", javaScript);


12/13/2007 2:52:33 AM 24353 articles. 2 followers. Follow

3 Replies

Similar Articles

[PageSpeed] 55
Get it on Google Play
Get it on Apple App Store

use the confirm method


confirm ('are you sure'); 


Das (
Dont forget to click "Mark as Answer" on the post that helped you. This marks your thread as Resolved so we will all know you have been helped.
12/13/2007 3:14:18 AM


 Could you elaborate more?


12/13/2007 3:34:59 AM

Instead of using the alert method, use the confirm method in JavaScript

Please visit the following links for more info: 


Das (
Dont forget to click "Mark as Answer" on the post that helped you. This marks your thread as Resolved so we will all know you have been helped.
12/13/2007 3:38:04 AM

Similar Artilces:

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 sankar    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: easy to use and does the job!!  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 click...

Modal Popup on Client-Side
Hello, Is it possible to determine in the client API that a user clicked the OK/Cancel option, either via enumeration or boolean property?  I'm accessing this on the client only, and am trying to figure out how I can tap into this to perform a client action. Thanks.Brian"Trust in the Lord and do what is good; dwell in the land and live securely. Take delight in the Lord, and He will give you your heart's desires" (Psalm 37: 3-4). You can do it by handling the following properties... OnOkScript - Script to run when the modal popup is dismissed with the OkControlID...

Throw Alert Msg Box from Server side Button Click
Hi,     I have a DropDownList control, a button control and a Grid Control on my page. I select a product from the ddl and click the button upon which that product gets added to the Grid. What I'm trying to do is check if the user is trying to add duplicate items from the ddl to the grid. I'm successful in doin that too. What I was wondering was about throwing an Alertbox with a message when the user tries to add a product that is already in the grid. I'm aware of button1.Attributes.Add(), but in my case 1. I need to check a condition on the button click which I doing on th...

Firing both Client side event and server side event for server side button
I am having some difficulties getting this to work.. I have button_click ( and ClientClick (Javascript).  Javascript is firing fine.  Server script is not. may be you have return return false in the in the javascript which is why its not firing server side event.You should add javascript evelt like thisbutton1.onclientclick = "functionname" Function should nopt return false. Vikram www.vikramlakhotia.comPlease mark the answer if it helped you...

how to call a c# function if user click on ok button of java script confirm box in .net
hi, i have one problem that is i'm adding the new user to database, if that user is already exist in the database one pop up should display with message like 'user already exists are u sure you want to update the role of the user' with 'yes' and 'no ' buttons on pop up, if user click on 'yes' button then it should call edituser() method of other wise it should reset the selected controls. how to do this using extenal .js file with javascript confirm box   Hi When user click on "Yes" set a hidden field value to be "t...

When downloading stuff, the download box that asks me where to save something does not fully display. Only the top half is there, not the Ok, Cancel buttons, etc
Name: Download box does not display fully Product: Gran Paradiso Summary: When downloading stuff, the download box that asks me where to save something does not fully display. Only the top half is there, not the Ok, Cancel buttons, etc Comments: I have DownThemAll installed, and am Using F3B5 and when I try to download something, the entire box does not display. I can't see the Ok, cancel, or download location boxes. Browser Details: Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.9b5) Gecko/2008032620 Firefox/3.0b5 From URL: ...

Calling server side function from client side alert
Hi, I am developing an ASP.Net application in which I am giving client side alert to the user with OK and Cancel buttons. Can I call a server side function from the click of this button? For e.g. I have to give user alert "Do you want to save record" with Yes/No button. On Yes button click it should go to the server and save the record. Can I call some server side function from the Yes button click? Any help in this regard will be highly appreciated. Thanks in advance. Ashish I would create a button control, say Button1. set Button1.visible=False then, ...

Validation Controls in .NET ( Client side or server side?)
 i have a very basic question. We have all these validation controls in ( required field, range validator and others) question is the required field validator is a server side control. So does that mean that it does a post back? it client side or server side control  The only controls that post back are buttons and other inputs where you set AutoPostback="True", such as a dropdownlist or a textbox.  Another way of posting back is using an UpdatePanel and placing a trigger in it for a specified control and/or event. All controls are considered clien...

Jscript, moving from client-side to server-side (.NET)
Hey all I’m working translating a web-app written in client-side Jscript to run on the server-side as JScript.NET. Without needing to get too specific, I am using Jscript because the original page aggregated raw data to produce statistical results (this was done dynamically based on user 'sort-by' options). The final output is an html report that can be emailed. Because this is currently being done on the client side, as the raw data grows the load-time grows as well (to the point that has almost become unusable). I’m posting here to see if anyone has any experi...

Conditional Client Side and Server Side call same button
I have a submit button on a form that I want to first do the validation and if valid call a client side javascript function and then run through its click event handler currently I have this set up by adding this line in the Page_Loadmybutton.Attributes.Add("onclick", "javascript:ShowRunningDialog(this);");But if the page is not valid I don't want to call this client side function. As it is now the 'ShowRunningDialog' is obviously going to be called no matter what     if (Page.IsValid) mybutton.Attributes.Add("onclick", &qu...

When to use client side varidation and server side varidation in .net?
In .net or classic web application we can varidate user data either on client isde or server side. How to select which side varidate to be used? Thanks! Generally, I use both client and server validation. I make sure the input is in the correct format and reasonably valid on the client, then I verify the data on the server. The extent of validation also depends on the type of data that I need to validate.Here are a few references:Validating ASP.NET Server ControlsIntroduction to Validating User Input in Web FormsClient-Side Validation for ASP.NET Server ControlsSecurity Checklist...

Calling server side sub from client side button click
Hi, I have some javascript in my page, and a function within that, which is run when the client side form is submitted. What I need is for that function to run, which updates a server side variable, then following that a server side sub should run, using that (newly updated) variable. I have currently set it up with the  onsubmit= tag of the client side form running the first (JavaScript) function, and then the submit button at the bottom of the client side form calling the server side sub with its onClick property. The (probably quite daft!) thinking behind that was that the on...

can clear server side text box value from client side.?
Hi, function Disab() {    if(document.all.chkSPTariff.checked)     {        document.all.txtVFX.disabled=false document.all.txtVHSFO.disabled=false    }  else  {     document.all.txtVFX.disabled=true document.all.txtVFX.value=""               }   This is how i am clearing  the  text for <asp:TextBox>. Ofter i submit, i wonder to see the old value from serverside , like txtTemp.Text is h...

I need to get a server side button to run this client side code?
I need to get a server side button to run this client side code when the server button is clicked and then subsequently called by the server. Is it possible? The problem is that the print control is a client side activex. I can call it normally using a client side button but this is no good when I need to print more then one page. Any help would be great. Thanks. The code: function PrintProc(){ var MyPrinter; MyPrinter = new ActiveXObject("ImgXPrint6.ImgXPrint"); MyPrinter.PageFrom = 1; MyPrinter.PageTo = 1; MyPrinter.PageM...

Web resources about - Alert Box with OK or Cancel Button -

Moddi - I have chosen to cancel my performance in Tel Aviv... - Facebook
I have chosen to cancel my performance in Tel Aviv on February 1st. This is without comparison the most difficult decision I have ever made as ...

Search Twitter - cancel spotify
Log in Sign up You are on Twitter Mobile because you are using an old version of Internet Explorer. Learn more here Search Refresh Top news story ...

US Airlines Cancel Israel Flights - YouTube
The Federal Aviation Administration is telling U.S. airlines they are prohibited from flying to the Tel Aviv airport in Israel after a Hamas ...

India's Kingfisher Airlines grounds fleet, cancels flights
... not allow Kingfisher Airlines to fly if saftey rules were not followed. NEW DELHI // Labour unrest forced India's Kingfisher Airlines to cancel ...

Council threatens to cancel Eat Street Markets Story Bridge tickets
City Hall has warned it will take back thousands of tickets to Brisbane's first Eat Street Markets event on the Story Bridge if their owners ...

Hewitt cancels Kooyong appearance (01:12)
With the Australian Open fast approaching, Lleyton Hewitt withdraws from the Kooyong Classic to prepare for the first major of the year. Nine ...

Bad weather in New Zealand cancel my hiking plans - Ben Groundwater
It's one of those uncontrollable factors that leaves travellers at its mercy.

Southbound comes to Perth's HBF Stadium as WA fires cancel Busselton festival
Southbound came to Perth on Sunday night in what proved to be an emotionally charged fundraiser - incredibly cobbled together at the eleventh ...

Merkel Cancels Davos Trip, Warns Refugee Sex Offenders Part of Organized Crime
... to growing pressure over the over the mass sexual assaults and robberies that took place in Cologne on New Year’s Eve, Angela Merkel cancelled ...

Brussels Cancels New Year's Eve Festivities Over Terror Threat
Brussels canceled its New Year’s Eve fireworks display and other festivities because of a “significant” risk of a terrorist attack as authorities ...

Resources last updated: 1/16/2016 8:19:59 PM