ASP.NET MVC 2 strongly typed htmlhelper, indexes

纵饮孤独 提交于 2019-12-06 02:55:13

The ability of the expression-based helpers to understand indexes isn't in the product yet. It will be in the next preview release (whatever comes after MVC 2 RC). See http://aspnet.codeplex.com/WorkItem/View.aspx?WorkItemId=4970.

Use the CheckBoxFor overload that allows you to specify html attributes:

CheckBoxFor(TModel)(HtmlHelper(TModel), Expression(Func(TModel, Boolean)), IDictionary(String, Object))

For example,

${Html.CheckBoxFor(x => x[fIndex].Checked, new { id = "foo" + fIndex) })}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!