Home > ASP.Net, Javascript > Show MessageBox Message with UpdatePanel

Show MessageBox Message with UpdatePanel


Hi all try this example to show MessageBox with UpdatePanel

1) Creat Class called MessageBox.cs


using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

/// <summary>
/// Summary description for MessageBox
/// </summary>
public class MessageBox
{
#region Constructor
public MessageBox()
{
//
// TODO: Add constructor logic here
//
}
#endregion
#region Void
public static void Show(UpdatePanel updatepanel, string message)
{
ScriptManager.RegisterStartupScript(updatepanel, updatepanel.GetType(), "MessageBox", "alert('" + message + "')", true);
}
public static void Show(Page page, string message)
{
ScriptManager.RegisterClientScriptBlock(page, page.GetType(), "MessageBox", "alert('" + message + "')", true);
}
#endregion
}

and to use it

MessageBox.Show(this,"Welcome to my blog");

Hope this helps

Good Luck

Advertisements
Categories: ASP.Net, Javascript
  1. abc
    February 13, 2012 at 5:21 am

    Very Nice exmpl……thanks a lot…

    • yasserzaid
      May 23, 2012 at 9:34 am

      @abc : you are welcome …. Good Luck

  2. Devendra
    May 15, 2012 at 1:16 pm

    Thanks ,it’s a Nice Example……..

    • yasserzaid
      May 23, 2012 at 9:33 am

      @Devendra : you are welcome

  3. Jofy
    June 5, 2012 at 11:10 am

    Thank you soo much … really helpfull ya …. thanks a ton again .. pls continue updating helpful solutions like this … Good going 🙂

  4. June 22, 2012 at 4:14 pm

    Great!!!!!thanks a lot!!

  5. Sassu Bogdan
    March 19, 2013 at 8:51 pm

    Nice example, very useful. Thanks a lot.

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: