I have the following aspx code:
<% foreach (ModelDefect modelDefect in GetCodes())
{%>
<tr>
<td><input disabled="disabled" name="<%= modelDefect.Code %>" value="<%= modelDefect.Code %>" type="checkbox" checked="<%=modelDefect.CompletedDate.HasValue? "checked":string.Empty %>" /></td>
<td><a href="javascript:submitForm('<%= modelDefect.DefectId %>');"><%= modelDefect.Code %></a></td>
<td><%= modelDefect.Description %></td><td><%= modelDefect.AddedDate %></td>
</tr>
<% } %>
I want the check box to be checked if there is a completed date, and unchecked if not. W3 doesn't appear to say how to leave it unchecked but include the attribute. I don't see a way to conditionally include that attribute on the item. I found a page that suggests that checked="yes" or checked="no" should work but it hasn't. I'd like a browser-independent and standards based solution or... a clean way to conditionally add that tag server side on my asp that is Ajax friendly? (Response.Write doesn't work in Asp.net AJax as I understand it.)