Click here to Skip to main content
15,796,734 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I am working on ASP.NET(4.0). In my application I have created some label at runtime.
I have one css file, in that file I have one class called "dy".
I have tried following code:
C#
lbl.cssclass="dy"

where lbl is my dynamic label object, but it is not working.

Please help me out.
Posted
Updated 6-Nov-11 1:17am
v2
Comments
Manfred Rudolf Bihy 6-Nov-11 4:40am    
No textspeak here please. Write in proper English.
André Kraak 6-Nov-11 6:18am    
Edited question:
Added pre tags
Formatted text/code
Replaced txt speak

1 solution

C#
Label lblNew = new Label();
lblNew.CssClass = "CssClass1";

Did you refer the stylesheet(Also check if the class dy exists in this stylesheet) in your page?

FYI WebControl.CssClass Property[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900