Friday, 19 October 2012

messagebox in asp.net c#

   private void ShowMessageBox(string msg)
    {
        //  Get a ClientScriptManager reference from the Page class.
        msg = msg.Replace("'", " ");
        msg = msg.Replace("\r", "");
        msg = msg.Replace("\n", "");
        ClientScriptManager cs = Page.ClientScript;
        // Check to see if the startup script is already registered.
        if (!cs.IsStartupScriptRegistered(this.GetType(), "PopupScript"))
        {
            cs.RegisterStartupScript(this.GetType(), "PopupScript", "alert('" + msg + "');", true);
        }
    }

No comments:

Post a Comment