Solved

Change CssClass in asp.net

Posted on 2011-09-12
2
631 Views
Last Modified: 2012-06-27
I have a label, <asp:Label ID="lblInfo" runat="server" Text="" />, and I want to set the CssClass of the label to “RedText” if one condition is met and to “BlackText” if another condition is met.

This is in an asp.net using VB for the code behind.

Any Ideas?
0
Comment
Question by:us1975mc
2 Comments
 
LVL 29

Accepted Solution

by:
Paul Jackson earned 500 total points
ID: 36523966
Simply set the cssclass in the code behind:

If ....  Then
    lblInfo.CssClass = "RedText"
Else
    lblInfo.CssClass = "BlackText"
End If
0
 

Author Closing Comment

by:us1975mc
ID: 36524001
Thanks.  Great work and super fast!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Name space syntax error 12 41
Word Directory is not in the drop down list 4 25
Want to create a userform that looks like the image provided 10 44
Error in JQuery 5 38
IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now