Yes / No vs OK / Cancel

Posted on 2007-11-19
Last Modified: 2011-09-20
lbTempTest.Attributes.Add("onClick", "return confirm('Do you want to add another Debt Item?');");

This part:

return confirm('Do you want to add another Debt Item?');

Do I have different options for this?

Can I do "Yes / No" buttons instead of "OK / Caoncel"?

How does this work?
Question by:knowlton

Assisted Solution

DavidTMoore earned 100 total points
Comment Utility
Javascript confirms are browser specific and cannot be changed.  You will need to build a custom control to achieve this.

LVL 16

Accepted Solution

gnoon earned 400 total points
Comment Utility
>Can I do "Yes / No" buttons instead of "OK / Caoncel"?
Yes, you can.

>How does this work?
You change to this

lbTempTest.Attributes.Add("onClick", "return (makeMsgBox('Confirm','Do you want to add another Debt Item?',2,4,0,0)==6);");

Then define the makeMsgBox function on the page
<script language=vbscript>


'Make user dialog appear

'@param title title string

'@param mess message string

'@param icon 

'	0 - no icon

'	1 - red cross

'	2 - question

'	3 - warning

'	4 - information

'@param buts

'	0 - [OK]

'	1 - [OK] [Cancel]

'	2 - [Abort] [Retry] [Cancel]

'	3 - [Yes] [No] [Cancel]

'	4 - [Yes] [No]

'	5 - [Retry] [Cancel]

'@param defbut

'	0 - 1st as default

'	1 - 2nd as default

'	2 - 3rd as default

'@param mods

'	0 - Application Modal

'	1 - System Modal

Function makeMsgBox(title,mess,icon,buts,defbut,mods)

    butVal = buts + (icon*16) + (defbut*256) + (mods*4096)

    makeMsgBox = MsgBox(mess,butVal,title)

End Function



Open in new window


Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This video discusses moving either the default database or any database to a new volume.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now