FAQ - showing popup messagebox in C# codebehind RRS feed

  • Question

  • User-364897957 posted

    Hi, I am just written to share some of the useful FAQ the people will ask.

    For Doing a Popup window in C# you can use the following code.

    You can Mode it into a method and do it everytime you need.


    protected void showMessageBox(string message)
            string sScript;
            message = message.Replace("'", "\'");
            sScript = String.Format("alert('{0}');", message);
            ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", sScript, true);




    Man Pak Hong, Dave


    Analyst Programmer

    Wednesday, April 28, 2010 4:42 AM

All replies

  • User2130758966 posted

    You could also use the ModalPopupExtender to dispaly messages and this can be called from the server side as well as client side:

    Wednesday, April 28, 2010 6:14 AM
  • User-364897957 posted

     Thanks for your advice. Actually, we have some error message or save completed message want to show to the user.

    Can you post me some sample code for the using of ModalPopupExtender that can be called from the server side?



    Man Pak Hong, Dave

    HP (Hong Kong Region)

    Analyst Programmer

    Wednesday, April 28, 2010 10:22 AM