Last post Aug 13, 2008 07:29 PM by etariq
Aug 13, 2008 06:18 PM|kraznodar|LINK
I have a CSS class that sits in Style.css. In the aspx page there is a simple html table. I added runat="server" to the table and gave it an ID. If certain conditions are met in the data pulled from the database, I need to add a CSS class to this table.
My problem is that there doesn't seem to be a CSSClass property to this table. I can add style code directly to the table but why do that if the CSS class already exists? So, How do I dynamically add a call to the class from my code behind?
Style in Style.css:
Aug 13, 2008 06:29 PM|sugan.v|LINK
I am not sure, but I cut and paste your code in my Visual studio 2008, and I can see the CssClass property in the table....
Aug 13, 2008 06:35 PM|kraznodar|LINK
You saw it in the code behind? Could you post how you got there?
Aug 13, 2008 07:13 PM|Armaghan|LINK
I think I know what you are asking. In order to add a css class to HTML controls, do the following in your code-behind:
Hope this helps
Aug 13, 2008 07:29 PM|etariq|LINK
there is anothere way remove the runat server of the table create a property or public var give it the class you want and in the class aatribute bind it to the var or property
<%= myvar %>