In the web application, some times we need to use a message style for
only one Label, like, suppose if our data has been added successfully, we display
message like 'Records has been added successfully'. So, depend on
system's different situation, we have to display label message with style color
So, Here you can find the solution. By it, you can display your message
with sytle as per your system's situation.
Just copy and paste the style script and copy C# method in your page.
You can find it here...
(Download these images for stylesheet)
protected void Page_Load(object sender, EventArgs e)
lblMessage.Text = "Records has been Added Successfully.";
private void SetStyle(Label objLabel, MessageType msgType)
objLabel.CssClass = "";
objLabel.CssClass = "MessageError";
objLabel.CssClass = "MessageInfo";
objLabel.CssClass = "MessageSuccess";
// Define enum in the outer side of your page class.
public enum MessageType
Now, Run your page and check it.
That's it !
Hope you will like it.
Thursday, June 12, 2008
Use Dynamic stylesheet class for messages in Asp.Net