Lomex Posted December 23, 2002 Share Posted December 23, 2002 I was wondering if there is a way to apply a style to lets say asp:label for example??? Or do I have to do class="label" and create the style for label in the style sheet? Link to comment Share on other sites More sharing options...
0 azcodemonkey Posted December 23, 2002 Share Posted December 23, 2002 In the code behind your aspx page (right-click in the Solution Explorer and choose View Code), in the Page_Load method, you can set your label's style by adding an attribute to it. // say your asp:label has an id of myLabel myLabel.Attributes.Add("style", "background-color:#ffffff; border:1px;"); ... You need to compile the code after you make any changes. You could also create a stylesheet, and appy the style to the label through the CssClass property of the label. Link to comment Share on other sites More sharing options...
0 Lomex Posted December 30, 2002 Author Share Posted December 30, 2002 That's what I had to do. Add the class to each single control.. I though in the stylesheet I could do something like asp:label { style here; } Link to comment Share on other sites More sharing options...
0 azcodemonkey Posted December 30, 2002 Share Posted December 30, 2002 Ah, well, an asp:label is rendered as a span. I haven't tried it myself, but you might try styling a span and see where that gets you. Link to comment Share on other sites More sharing options...
Question
Lomex
I was wondering if there is a way to apply a style to lets say asp:label for example???
Or do I have to do class="label" and create the style for label in the style sheet?
Link to comment
Share on other sites
3 answers to this question
Recommended Posts