MVC Checkbox List
Posted
by David in Dakota
on Stack Overflow
See other posts from Stack Overflow
or by David in Dakota
Published on 2010-05-27T04:36:33Z
Indexed on
2010/05/27
4:41 UTC
Read the original article
Hit count: 778
asp.net-mvc
|checkboxlist
I just wrote perhaps the ugliest bit of MVC code in existence. It is:
<table>
<tr>
<%
int i = 0;
foreach(Thyla.Models.Tag tag in this.Model)
{
i += 1;
%>
<td>
<span>
<input type="checkbox" name="TagSelector" id='<%= tag.TagName%>' value='<%= tag.TagName%>' />
<label for="<%= tag.TagName%>" title="<%= tag.TagName%>"><%= tag.TagName%></label>
</span>
</td>
<%if (i % 5 == 0){%>
</tr><tr>
<%} %>
<%} %>
<% if (i % 5 != 0){%></tr><%} %>
</table>
What is the canonical approach to making a checkbox list with a specified number of columns in ASP.NET MVC?
© Stack Overflow or respective owner