I have asp:Table with number of asp:Label inside asp:FormView, it represents short stats info.
I need to set Label.CssClass to “red” if it’s text isn’t “0”.
Currently I do this on FormView.DataBound event. But think that it’s better to use JavaScript and probably jQuery. How can I do that?
Sorry for dummy question – I’m new to jQuery. Thanks!
You can do this using jQuery (you can also give the Table or FormView a class, probably easier in aps.net instead of the
IDlike I have below):If you give the labels a class you want affected, say set all the Labels you want included to
CssClass="styleMe", you could change$("#formViewID span")to$("#formViewID span.styleMe")to be more specific.