Manage CSS & Message Box(javascript) using C#.NET , ASP.NET Code at run time...

Task:  How can open a pop-up message box using or add css/javascript using c# code. (JavaScript alert box).

Description:  After the completing some task we have to show a message for user so that we need a message box. Here the first code is for creating a CSS dynamically using code and second one for generating a message box using c# code.

C# Code : For Dynamic Css C# Code

  protected void Page_Load(object sender, EventArgs e)
  string c = "#f0ff0f";
        string d = "#0f0f00";
        LiteralControl ltr = new LiteralControl();
        ltr.Text = "<style type=\"text/css\" rel=\"stylesheet\">" +
                        color:" + c + @";
                        color:" + d + @";


////////////////// Message Box in website

C# Code : For Message Box in Asp.Net C#

    public void msgbox(string message)
        string msg = @"alert('" + message + "');";
        ScriptManager.RegisterStartupScript(this, this.GetType(), "s1", msg, true);

1 comment:

  1. The Kettic Message Box Control is able to show text, buttons, and symbols that inform and instruct the user as well as system icon, status, and error information.