Wednesday, April 9, 2008

Show message box in ASP.NET

I've written a simple function which uses JavaScript.

private void ShowMessageBox(string Message)
{

Label lblMessageBox = new Label();

lblMessageBox.Text =

"<script language='javascript'>" + Environment.NewLine +
"window.alert('" + Message + "')</script>";

Page.Controls.Add(lblMessageBox);

}

To call out the message box, just write this:

ShowMessageBox("Hello world!");

The problem with this is that I can't customize the message box. I can only pass in the message as parameter, but not changing the title, the button text or image.
Message box

8 comments:

  1. Thanks, it works well....

    ReplyDelete
  2. axomireetrect http://buy-suhagra.wikidot.com http://buy-mobic.wikidot.com http://buy-eriacta.wikidot.com axomireetrect

    ReplyDelete
  3. Hello
    http://psbtrainer.com/ - valium cost
    If any of these occur, the drug must be discontinued.
    [url=http://psbtrainer.com/]buy cheap valium[/url]
    There were rare cases of elevated transaminases and alkaline phosphatase as well as cases of jaundice reported.
    valium drug

    Venous thrombosis, phlebitis, local irritation, swelling or less frequently, vascular changes may occur, particular after rapid IV injection.

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

    ReplyDelete
  5. calainark [url=http://www.ibanezwiki.com/display/~here-you-can-buy-flagyl-online]flagyl side effects[/url] Flagyl [url=http://docs.safehaus.org/display/~buy-ambien-without-prescription-online]cheap ambien[/url] Ambien [url=http://blog.mreza.info/members/Cheapest-place-to-buy-Prednisone-without-prescription.aspx]effects of prednisone on dog[/url] Prednisone [url=http://blog.mreza.info/members/Cheapest-place-to-buy-Viagra-without-prescription.aspx]cheap viagra[/url] Viagra [url=http://wiki.sla.org/display/~where-can-i-buy-vicodin-es-online-without-no-prescription]snort a vicodin[/url] Vicodin ES AdandHaut

    ReplyDelete
  6. calainark [url=http://www.ibanezwiki.com/display/~here-you-can-buy-viagra-online]viagra uk[/url] Viagra [url=http://wiki.sla.org/display/~where-can-i-buy-propecia-online-without-no-prescription]canada pharmacy propecia[/url] Propecia [url=http://docs.safehaus.org/display/~buy-prednisone-without-prescription-online]prednisone medication[/url] Prednisone [url=http://blog.mreza.info/members/Cheapest-place-to-buy-Vicodin-ES-without-prescription.aspx]how long does vicodin stay in your system[/url] Vicodin ES [url=http://docs.safehaus.org/display/~buy-zithromax-without-prescription-online]alcohol and zithromax[/url] Zithromax AdandHaut

    ReplyDelete
  7. Ancedeelime [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-lasix-without-prescription]what is lasix used for[/url] Lasix [url=http://wiki.openqa.org/display/~where-can-i-buy-ativan-without-prescription]zoloft online alcohol and zoloft2c ativan[/url] Ativan [url=http://wiki.openqa.org/display/~where-can-i-buy-vicodin-es-without-prescription]snort a vicodin[/url] Vicodin ES [url=http://wiki.openqa.org/display/~where-can-i-buy-ambien-without-prescription]ambien addiction[/url] Ambien Immefeabajern

    ReplyDelete
  8. Ancedeelime [url=http://wiki.openqa.org/display/~where-can-i-buy-ativan-without-prescription]ativan celexa sonata[/url] Ativan [url=http://wiki.openqa.org/display/~where-can-i-buy-ambien-without-prescription]ambien online[/url] Ambien [url=http://wiki.openqa.org/display/~where-can-i-buy-valium-without-prescription]buy valium online without a prescription[/url] Valium [url=http://wiki.openqa.org/display/~where-can-i-buy-prozac-without-prescription]prozac nation[/url] Prozac [url=http://wiki.openqa.org/display/~where-can-i-buy-prednisone-without-prescription]allergy dog prednisone[/url] Prednisone Immefeabajern

    ReplyDelete