asp.net Html.CheckBoxListFor,职位不存在
asp.net Html.CheckBoxListFor, Position doesn't exist
我正在尝试使用 Position.Vertical 使我的复选框列表垂直,但不断收到错误 "the name "Position" 在当前上下文中不存在"
@Html.CheckBoxListFor(modelItem => item.Value.postedItems.IDs,
modelItem => item.Value.availItems,
i => i.Id,
i => i.Name,
modelItem => item.Value.selectedItems,
Position.Vertical)
如果我转到 Html.checkboxlistfor 的定义,则会覆盖参数 Position,但由于某些原因未使用它。
public static MvcHtmlString CheckBoxListFor<TModel, TProperty, TItem, TValue, TKey>(this HtmlHelper<TModel> htmlHelper, Expression<Func<TModel, TProperty>> listNameExpr, Expression<Func<TModel, IEnumerable<TItem>>> sourceDataExpr, Expression<Func<TItem, TValue>> valueExpr, Expression<Func<TItem, TKey>> textToDisplayExpr, Expression<Func<TModel, IEnumerable<TItem>>> selectedValuesExpr, HtmlListInfo wrapInfo);
public static MvcHtmlString CheckBoxListFor<TModel, TProperty, TItem, TValue, TKey>(this HtmlHelper<TModel> htmlHelper, Expression<Func<TModel, TProperty>> listNameExpr, Expression<Func<TModel, IEnumerable<TItem>>> sourceDataExpr, Expression<Func<TItem, TValue>> valueExpr, Expression<Func<TItem, TKey>> textToDisplayExpr, Expression<Func<TModel, IEnumerable<TItem>>> selectedValuesExpr, Position position);
使用第一个替代而不是第二个。有没有办法强制使用第二种情况?
我认为你的问题是你没有声明正确的 "using" 引用。
尝试将 @using MvcCheckBoxList.Model
添加到您的视图。
我正在尝试使用 Position.Vertical 使我的复选框列表垂直,但不断收到错误 "the name "Position" 在当前上下文中不存在"
@Html.CheckBoxListFor(modelItem => item.Value.postedItems.IDs,
modelItem => item.Value.availItems,
i => i.Id,
i => i.Name,
modelItem => item.Value.selectedItems,
Position.Vertical)
如果我转到 Html.checkboxlistfor 的定义,则会覆盖参数 Position,但由于某些原因未使用它。
public static MvcHtmlString CheckBoxListFor<TModel, TProperty, TItem, TValue, TKey>(this HtmlHelper<TModel> htmlHelper, Expression<Func<TModel, TProperty>> listNameExpr, Expression<Func<TModel, IEnumerable<TItem>>> sourceDataExpr, Expression<Func<TItem, TValue>> valueExpr, Expression<Func<TItem, TKey>> textToDisplayExpr, Expression<Func<TModel, IEnumerable<TItem>>> selectedValuesExpr, HtmlListInfo wrapInfo);
public static MvcHtmlString CheckBoxListFor<TModel, TProperty, TItem, TValue, TKey>(this HtmlHelper<TModel> htmlHelper, Expression<Func<TModel, TProperty>> listNameExpr, Expression<Func<TModel, IEnumerable<TItem>>> sourceDataExpr, Expression<Func<TItem, TValue>> valueExpr, Expression<Func<TItem, TKey>> textToDisplayExpr, Expression<Func<TModel, IEnumerable<TItem>>> selectedValuesExpr, Position position);
使用第一个替代而不是第二个。有没有办法强制使用第二种情况?
我认为你的问题是你没有声明正确的 "using" 引用。
尝试将 @using MvcCheckBoxList.Model
添加到您的视图。