I have some trouble with Rows taking styles sometimes. Move the ID to the TD tag and see if that works.
Jeremy Sullivan
2009-06-09 01:57:39
I have some trouble with Rows taking styles sometimes. Move the ID to the TD tag and see if that works.
When the HtmlHelper render itself it checks if there is any item in the ModelState dictionary that has the same key as the helper itself. if so the control will be rendered with the attribute class equal to "input-validation-error" which is defined in the css file.
So, the style will be applied only on the rendered input controls.
This is my solution:
<table width="100%">
<tr>
<td>
<label>
How would you like us to contact you?
</label>
</td>
</tr>
<tr class="<%=ViewData.ModelState["pref_row"]!= null ? "input-validation-error":"" %>">
<td>
<span class="bold-text">Email: </span>
<%=Html.CheckBox("EmailDesired")%>
<span class="bold-text">Phone: </span>
<%=Html.CheckBox("PhoneDesired")%>
</td>
</tr>
</table>