开发者

Looping checkboxes and checked if exists

I'm trying to generate a list of checkboxes, and make them checked if they exists for a product. Kinda like Products <-> ProductsCategories <-> Categories

Kinda like:

<%
    foreach(var x in Model.Categories)
{
    %>
    <%= 开发者_StackOverflow中文版Html.CheckBox("CategoryID", checked if exists in Model.Product.Categories)%>
    <%
}
%>

How is that done?

/M


<%= Html.CheckBox("CategoryID", Model.Product.Categories.Contains(x))%>

Hope that helps,

Kindness,

Dan

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜