I know that you can assign a class to the generated table
by using CssClass
on the RadioButtonList
but I need to be able to style the generated <td>
's individually.
Easy with JQuery but I'd much rather not have to resort to that.
Adding cssClass="myClass"
to the ListItem
results in the following broken HTML
<table id="myTable">
<tbody>
<tr>
<td>
<span cssclass="some_class"> // Well this is rubbish!
<input id="myRadioInput" type="radio" name="myRadioInput" value="myValue" >
<label for="myRadioInput">myLabel</label>
</span>
</td>
<td>
<input id="myRadioInput2" type="radio" name="myRadioInput2" value="myValue2">
<label for="myRadioInput2">myLabel2</label>
</td>
</tr>
</tbody>
</table>
So my question is: Is it actually posible to either assign a class or apply inline styling to the generated <td>
's INDIVIDUALLY?
PLEASE NOTE This is a question about ASP.NET. Answers that simply tell me how to style HTML elements are not answering the question.
To style all the td's you could add the CSS like so...
#myTable td{
color:Red;
}
Other than that (if you wanted different styles for each td) jQuery would be the only way to add classes to those generated td's.
$('#myTable td:eq(0)').addClass('td1');
$('#myTable td:eq(1)').addClass('td2');
...
OR
$.each($('#myTable td'), function(i){
$(this).addClass('td'+i);
});
This is one of the reasons I dislike ASP.NET controls with all the extra markup you have no control of through the properties panel.