@HTML.CheckBoxFor() MVC 3.0 Issue?
I have a loop that generates List of items with Check box to select
foreach(var i in item)
{
@Html.CheckBoxFor(x=>i.Checked)
@Html.labelfor(x=>i.price)
}
I have 3 items. so this is Producing below code three 开发者_如何学运维times
<input id="paid" name="paid" value="true" type="checkbox">
<input name="paid" value="false" type="hidden">
Now when i try to access the checked prices in my controller
string[] paid = Request.Form["paid"].split(',');
I should receive 3 values of true/false, irrespective of how many prices were check by the user
Instead, it returns 3+ as many as user checked. Lets say if user check one price then in my controller. I will receive 3+1= 4 true/false values.
How can i get rid of this issue?
I think what you are looking for is this post. http://forums.asp.net/t/1314753.aspx
精彩评论