Reputation: 12696
I'm currently trying to create a view in asp.net MVC2 which includes a checkbox in each row. This will be a "mark" box, and there will be a button on the view which can then be used for multiple deletion.
I have a model which contains a list of the objects being listed, so I have some code which reads as:-
<% foreach (CancelledCard item in Model.CancelledCards) { %>
I've then tried to use
<%: Html.CheckBoxFor(item >= item.Checked) %>
but I'm getting an error.
What am I missing? What's the right way to do this in MVC2?
Upvotes: 0
Views: 582
Reputation: 13581
<%: Html.CheckBoxFor(item >= item.Checked) %>
is wrong. It should be:
<%: Html.CheckBoxFor(item => item.Checked) %>
Upvotes: 0
Reputation: 1038800
In C# a lambda expression uses =>
and not >=
:
<%: Html.CheckBoxFor(item => item.Checked) %>
Also instead of saying that you get an error, you could have posted the error message. It would have been much more clear.
Upvotes: 2