【发布时间】:2010-05-27 13:07:12
【问题描述】:
class person()
{
public int Id{get;set;}
public string Name{get;set;}
}
HomeController.cs
ActionResult Index()
{
IList list=new[]{
new person { Id = 1, Name = "Name1" },
new person { Id = 2, Name = "Name2" },
new person { Id = 3, Name = "Name3" }
};
ViewData["mygrid"]=list;
return view();
}
首页\Index.spark
!{Html.Grid[[person]]("mygrid",
(column=>{
column.For(c=>c.Id);
column.For(c=>c.Name);
}))
我得到了错误
动态视图编译失败..错误 CS1501:方法 'Grid' 没有重载需要 '2' 个参数。
我添加了对 MvcContrib.dll 的引用 并在 _global.spark 文件中添加了以下命名空间
<use namespace="MvcContrib.UI"/>
<use namespace="MvcContrib.UI.Grid"/>
<use namespace="MvcContrib.UI.Pager"/>
<use namespace="MvcContrib.UI.Grid.ActionSyntax"/>
<use namespace="Microsoft.Web.Mvc.Controls"/>
我想在 spark 视图中将数据绑定到我的网格。谁能帮忙。
【问题讨论】: