我正在尝试将引导样式应用于以下下拉列表:
@Html.DropDownList("Scholarship_contactID","-- Select Contact --",new { @class = "form-control"})
这将返回以下错误:
‘System.Web.Mvc.HtmlHelper’ does not contain a deFinition for ‘DropDownList’ and the best extension method overload ‘System.Web.Mvc.Html.SelectExtensions.DropDownList(System.Web.Mvc.HtmlHelper,string,System.Collections.Generic.IEnumerable,string)’ has some invalid arguments
解决方法
您没有为下拉列表中的项目提供任何内容.
注意这部分错误:
System.Collections.Generic.IEnumerable
@Html.DropDownList("Scholarship_contactID",new SelectList(new List<string>()),new { @class = "form-control"})
这使用以下重载:
public static MvcHtmlString DropDownList( this HtmlHelper htmlHelper,string name,IEnumerable<SelectListItem> selectList,string optionLabel,object htmlAttributes )
原文地址:https://www.jb51.cc/csharp/98186.html
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。