Sunday, December 12, 2010

Message Box in ASP.NET using JavaScript

C# ASP.NET doesn't directly support Message Boxes inherently. However you can emulate this using embedded javaScript. See below:



    private void MessageBox(string message)
    {
        if (!string.IsNullOrEmpty(message))
        {
            Response.Write
         ("<script type=\"text/javascript\" language=\"javascript\">");
            Response.Write("alert('" + message + "');");
            Response.Write("</script>");
        }
    }

1 comment:

  1. Although having very similar names, Java and JavaScript are totally two different

    languages separately but they are able to create the web-based applications.

    JavaScript is supported by all browsers, but Java is not.To learn more:

    java training

    ReplyDelete