Saturday, 15 February 2014

asp.net mvc - Do not render table row checkboxes when collection count is zero with razor -


I have to display a list of items using MVC razor.

Each list item has a checkbox

when it is list.count> This checkbox should be added only in html / html / html 0

Would you render / add each item checkbox to each item if not using any clause?

If you are trying to cut the markup, then you can use conditional operators:

@ (list.Any ()? @ Html.CheckBox ("name", correct): zero)


No comments:

Post a Comment