Click to See Complete Forum and Search --> : How to set the css class of a td tag?


web_master
June 6th, 2007, 09:53 AM
I need to set the css class of a <td> tag from the codebehind and there is no cssclass in the list of properties for that variable. Is there any other way to set the class of that tag? I can add all the style elements with td.Style.Add but thats not pretty when u have a lot of things and u already have those defined in a class.

Thanks!

mcmcom
June 6th, 2007, 01:54 PM
why does it have to be in codebehind ?

you can simply do this on the main page : <td class="myClass"></td>

however if you want to do it in codebehind i believe you would do something like

mytableCell.Attributes.Add("class","myClass");


this link has more

http://www.velocityreviews.com/forums/t75095-re-how-can-i-change-an-elements-class-in-the-code-behind.html

hth,
mcm