【发布时间】:2013-08-14 15:13:11
【问题描述】:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Test.Models;
namespace Test.Controllers
{
public class HomeController : Controller
{
public ActionResult Index()
{
var model = new DropDownListData();
model.DropDownListItems.Add(new SelectListItem { Text = "Sun", Value = "1" });
return View(model);
}
}
}
这么说
System.Collections.Generic.IEnumerable<System.Web.Mvc.SelectListItem> 不包含“添加”的定义,并且找不到接受System.Collections.Generic.IEnumerable<System.Web.Mvc.SelectListItem> 类型的第一个参数的扩展方法“添加”(您是否缺少 using 指令或程序集引用?)
我缺少什么参考资料?
【问题讨论】:
-
你的
model.DropDownListItems属性是什么类型的?
标签: c# asp.net-mvc asp.net-mvc-4 asp.net-mvc-controller selectlistitem