How to set CSSClass for dynamically created label in asp.net using C #
Label lbl = new Label(); lbl.Text = "Hello World!"; lbl.CssClass = "red_and_bold";
When you create a shortcut, set its CssClass property:
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.webcontrol.cssclass.aspx
If you mean server-side configuration, you can use the WebControl.CssClass property:
Label lblPrivacyGender = new Label (); lblPrivacyGender.Attributes.Add ("class", "spanHeaderStyle"); lblPrivacyGender.Text = "Gender:";
Above spanHeaderStyle is a CssClass that was previously defined