Task: How can open a pop-up message box using
asp.net 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# asp.net 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\">" +
@".d
{
color:" + c + @";
}
.d:hover
{
color:" + d + @";
}
</style>
";
this.Page.Header.Controls.Add(ltr);
}
.
////////////////// Message Box in asp.net/c#.net 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);
}
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.
ReplyDelete