Pages

Advertisement

Friday, July 13, 2007

Web Tip: Add Message and Confirmation Boxes Using JavaScript

Any time I have a Delete or Cancel button, I add a JavaScript confirmation dialog to keep the user from doing something he might regret. In other cases, a simple alert with an OK dialog is sufficient. To save myself some time, I've created the following two functions to do this work for me:

public void AddConfirmMessage(WebControl ctl, string message)
{
ctl.Attributes.Add("onclick", "if ( ! confirm( '"
+ message + "' )) return false; ");
}

public void AddPopupMessage(WebControl ctl, string message)
{
ctl.Attributes.Add("onclick", "alert( '" + message + "'); ");
}
They accept a generic WebControl object and edit the Attributes collection of that control, which adds the JavaScript code to the control from the code-behind. These functions will work with any control that derives from the WebControl class. Simply pass in the control and the message you want to display, and as long as the user has JavaScript enabled, the messages will appear.

27 comments:

Anonymous said...

I found this site using [url=http://google.com]google.com[/url] And i want to thank you for your work. You have done really very good site. Great work, great site! Thank you!

Sorry for offtopic

Anonymous said...

I found this site using [url=http://google.com]google.com[/url] And i want to thank you for your work. You have done really very good site. Great work, great site! Thank you!

Sorry for offtopic

Anonymous said...

I found this site using [url=http://google.com]google.com[/url] And i want to thank you for your work. You have done really very good site. Great work, great site! Thank you!

Sorry for offtopic

Anonymous said...

Eleviftfels http://buy-suhagra.wikidot.com http://voltarol.wikidot.com http://buy-apcalis.wikidot.com Eleviftfels

Anonymous said...

Online Buy Viagra for women Buy Viagra mexico
[url=http://wikipatterns.com/display/~buy-cialis-genericoviagra]Online Buy Viagra for women Buy Viagra usa[/url]
Online Buy Viagra for women Buy Viagra pills http://www.refractions.net:8080/confluence/display/~boys_viagra
vertiloapolsas

Anonymous said...

[url=http://comprare-kamagra-italia.wikidot.com/][IMG]http://s11.radikal.ru/i183/0910/4f/9ae7cddaec55.jpg[/IMG][/url]

[url=http://comprare-kamagra-italia.wikidot.com]cheap usa Kamagra[/url] kamagra

Anonymous said...

Could not find a suitable section so I written here, how to become a moderator for your forum, that need for this?

Anonymous said...

calainark [url=http://wiki.sla.org/display/~where-can-i-buy-ambien-online-without-no-prescription]ambien side effects[/url] Ambien [url=http://docs.safehaus.org/display/~buy-prednisone-without-prescription-online]prednisone pregnancy[/url] Prednisone [url=http://www.ibanezwiki.com/display/~here-you-can-buy-ambien-online]ambien addiction[/url] Ambien [url=http://blog.mreza.info/members/Cheapest-place-to-buy-Ambien-without-prescription.aspx]ambien ultram[/url] Ambien [url=http://docs.safehaus.org/display/~buy-ativan-without-prescription-online]can you take ativan with celexa[/url] Ativan AdandHaut

Anonymous said...

56 4
491 4
6 5
251 2
190 8
426 0
67 1
335 0

Anonymous said...

Ancedeelime [url=http://wiki.openqa.org/display/~where-can-i-buy-ativan-without-prescription]ativan[/url] Ativan [url=http://wiki.openqa.org/display/~where-can-i-buy-valium-without-prescription]buy valium no prescription[/url] Valium [url=http://wiki.openqa.org/display/~where-can-i-buy-flagyl-without-prescription]flagyl side effects[/url] Flagyl [url=http://wiki.openqa.org/display/~where-can-i-buy-propecia-without-prescription]does propecia work[/url] Propecia [url=http://wiki.openqa.org/display/~where-can-i-buy-prednisone-without-prescription]prednisone medication[/url] Prednisone Immefeabajern

Anonymous said...

Gyperlarlibra [url=http://manatee-boating.org/members/Where--to-buy-Prozac-online-without-prescription.aspx]drug interaction prozac ultram[/url] Prozac [url=http://manatee-boating.org/members/Where--to-buy-Viagra-online-without-prescription.aspx]cheap viagra[/url] Viagra [url=http://manatee-boating.org/members/Acquisto-Kamagra-on-line.aspx]dove acquistare senza prescrizione Kamagra[/url] Kamagra [url=http://manatee-boating.org/members/Where--to-buy-Propecia-online-without-prescription.aspx]finasteride propecia[/url] Propecia [url=http://manatee-boating.org/members/Acquisto-Cialis-on-line.aspx]cheap cialis[/url] Cialis occumbBon

Anonymous said...

Good day !.
might , probably very interested to know how one can make real money .
There is no need to invest much at first. You may start earning with as small sum of money as 20-100 dollars.

AimTrust is what you thought of all the time
The firm incorporates an offshore structure with advanced asset management technologies in production and delivery of pipes for oil and gas.

It is based in Panama with affiliates around the world.
Do you want to become really rich in short time?
That`s your chance That`s what you desire!

I`m happy and lucky, I began to get income with the help of this company,
and I invite you to do the same. If it gets down to select a proper partner utilizes your savings in a right way - that`s it!.
I earn US$2,000 per day, and my first deposit was 1 grand only!
It`s easy to get involved , just click this link http://olyhijimiq.s-enterprize.com/paxaxet.html
and lucky you`re! Let`s take this option together to feel the smell of real money

Anonymous said...

RaistUrifsraw [url=http://thinkmobile.it/members/Levitra-quanto-costa-in-farmacia-Compra-Levitra-in-Italia/default.aspx]viagra cialis levitra[/url] Levitra [url=http://thinkmobile.it/members/Kamagra-quanto-costa-in-farmacia-Compra-Kamagra-in-Italia/default.aspx]dove acquistare senza prescrizione Kamagra[/url] Kamagra [url=http://usr-ict.cs.unicam.it/members/Kamagra-senza-ricetta-comprare-Kamagra-prescrizione-medica.aspx]farmacia Kamagra[/url] Kamagra [url=http://sicilia.tostring.it/members/Comprare-Cialis-online-senza-ricetta/default.aspx]buy cialis online[/url] Cialis Illituddy

Anonymous said...

RaistUrifsraw [url=http://thinkmobile.it/members/Cialis-quanto-costa-in-farmacia-Compra-Cialis-in-Italia/default.aspx]buy cialis online[/url] Cialis [url=http://sicilia.tostring.it/members/Comprare-Viagra-online-senza-ricetta/default.aspx]viagra[/url] Viagra [url=http://usr-ict.cs.unicam.it/members/Viagra-senza-ricetta-comprare-Viagra-prescrizione-medica.aspx]generic viagra[/url] Viagra [url=http://thinkmobile.it/members/Kamagra-quanto-costa-in-farmacia-Compra-Kamagra-in-Italia/default.aspx]dove acquistare senza prescrizione Kamagra[/url] Kamagra mournrofemige

Anonymous said...

RaistUrifsraw [url=http://thinkmobile.it/members/Cialis-quanto-costa-in-farmacia-Compra-Cialis-in-Italia/default.aspx]buy cialis[/url] Cialis [url=http://thinkmobile.it/members/Levitra-quanto-costa-in-farmacia-Compra-Levitra-in-Italia/default.aspx]viagra cialis levitra[/url] Levitra MiffNeift

Anonymous said...

RaistUrifsraw http://kaufen-cialis.wikidot.com MiffNeift

Anonymous said...

RaistUrifsraw [url=https://launchpad.net/~buy-ativan-without-prescription]can you take ativan with celexa[/url] Ativan [url=https://launchpad.net/~buy-codeine-online-without-prescription]codeine phosphate[/url] Codeine [url=https://launchpad.net/~buy-differin-without-prescription]differin cost[/url] Differin [url=https://launchpad.net/~buy-ambien-without-prescription]order ambien[/url] Ambien

Anonymous said...

Could not find a suitable section so I written here, how to become a moderator for your forum, that need for this?

Anonymous said...

Diewiplygew [url=http://wiki.openqa.org/display/~buy-bactrim-without-no-prescription-online]Buy Bactrim without no prescription online[/url] [url=http://wiki.openqa.org/display/~buy-buspar-without-no-prescription-online]Buy Buspar without no prescription online[/url]

Anonymous said...

Diewiplygew [url=http://wiki.openqa.org/display/~buy-bactrim-without-no-prescription-online]Buy Bactrim without no prescription online[/url] [url=http://wiki.openqa.org/display/~buy-prednisone-without-no-prescription-online]Buy Prednisone without no prescription online[/url]

Anonymous said...

によろしくと伝えてください。 [url=http://ci2s.org/viagura.htm]バイアグラ[/url] バイアグラ

Anonymous said...

見て! [url=http://ci2s.org/viagura.htm]バイアグラ[/url] バイアグラ 服用

Anonymous said...

Bitte, erklären Sie ausführlicher viagra rezeptfrei levitra rezeptfrei [url=http//t7-isis.org]viagra bestellen deutschland[/url]

Anonymous said...

Condivido pienamente il suo punto di vista. Mi piace la tua idea. Offerta di mettere una discussione generale. [url=http://lacasadicavour.com/kamagra-oral-jelly/ ]cialis 20 mg prezzi [/url]Tempestiva argomento http://lacasadicavour.com/tag/tadalafil/ cialis 20 Che cosa buona domanda

Anonymous said...

Hi there!
I would like to burn a theme at this forum. There is such a thing, called HYIP, or High Yield Investment Program. It reminds of financial piramyde, but in rare cases one may happen to meet a company that really pays up to 2% daily not on invested money, but from real profits.

For several years , I make money with the help of these programs.
I don't have problems with money now, but there are heights that must be conquered . I make 2G daily, and I started with funny 500 bucks.
Right now, I'm very close at catching at last a guaranteed variant to make a sharp rise . Turn to my blog to get additional info.

http://theblogmoney.com

Anonymous said...

Hello!
You may probably be very curious to know how one can make real money on investments.
There is no initial capital needed.
You may begin to get income with a sum that usually is spent
for daily food, that's 20-100 dollars.
I have been participating in one project for several years,
and I'll be glad to let you know my secrets at my blog.

Please visit my pages and send me private message to get the info.

P.S. I make 1000-2000 per daily now.

[url=http://theinvestblog.com] Online investment blog[/url]

Anonymous said...

Hi there!
I would like to burn a theme at here. There is such a nicey, called HYIP, or High Yield Investment Program. It reminds of financial piramyde, but in rare cases one may happen to meet a company that really pays up to 2% daily not on invested money, but from real profits.

For quite a long time, I make money with the help of these programs.
I don't have problems with money now, but there are heights that must be conquered . I get now up to 2G a day , and I started with funny 500 bucks.
Right now, I managed to catch a guaranteed variant to make a sharp rise . Visit my blog to get additional info.

http://theinvestblog.com [url=http://theinvestblog.com]Online Investment Blog[/url]