我正在尝试在 ac#MVC4 项目中掌握 WebGrid。下面的代码给出了这个错误...
编译器错误消息:CS1502:最佳重载方法匹配 'System.Web.Helpers.WebGrid.WebGrid(System.Collections.Generic.IEnumerable, System.Collections.Generic.IEnumerable, string, int, bool, bool, string, string , string, string, string, string, string)' 有一些无效参数
@{
Layout = null;
}
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width" />
@{
List<int> obj1 = new List<int>(){ 1, 2, 3, 4 };
var obj1_i = (IEnumerable<int>)obj1;
var grid = new WebGrid(obj1_i);
}
</head>
<body>
<div>
@grid.GetHtml()
</div>
</body>
</html>