首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Mvc CheckBoxListFor命名参数规范错误

Mvc CheckBoxListFor命名参数规范错误
EN

Stack Overflow用户
提问于 2016-05-24 17:03:13
回答 1查看 179关注 0票数 1

我正在使用Mvc CheckBoxListFor扩展。参数规范在我看来是非常正确的,因为它显示在演示中,但它仍然给我命名的参数规范,必须在所有固定参数都被指定错误之后出现。我还想指定id属性。

谢谢你提前提供帮助。

代码语言:javascript
复制
@Html.CheckBoxListFor(model => model.Categories.PostedCategories.CategoryIds,
   model => model.Categories.AvailableCategories,
   entity => entity.CategoryId,
   entity => entity.Name,
   model => model.Categories.SelectedCategories,
   position: Position.Horizontal,
   x => new { @class = "actcheckbox" }) // here is the line that occurs that error.
   @Html.ValidationMessage("catSelectionError")
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-05-24 17:17:13

正如错误消息所示,您有一个命名的参数,后面跟着一个固定的参数-- position: Position.Horizontal。看来你需要做以下几件事:

代码语言:javascript
复制
@Html.CheckBoxListFor(model => model.Categories.PostedCategories.CategoryIds,
   model => model.Categories.AvailableCategories,
   entity => entity.CategoryId,
   entity => entity.Name,
   model => model.Categories.SelectedCategories,
   Position.Horizontal,  // NB: No argument name
   x => new { @class = "actcheckbox", id = "myid" })  // Add id here
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/37419777

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档