@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)总结
以上是内存溢出为你收集整理的c# – 将Bootstrap类应用于@ Html.DropDownList()全部内容,希望文章能够帮你解决c# – 将Bootstrap类应用于@ Html.DropDownList()所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)