【发布时间】:2011-08-23 12:21:10
【问题描述】:
我有一个呈现 WebGrid 的局部视图。我的控制器看起来像
public ActionResult Index()
{
return View();
}
public ActionResult GetUserList(int? page, string sort, string sortdir)
{
var model = UserModel.getList(page,sort,sortdir);
return PartialView("_UserList",model);
}
Index.cshtml :....
@Html.Action("GetUserList")
问题是每次我单击网格导航或排序链接时,它都会调用Index 方法。如何让 Webgrid 执行不同的操作(在这种情况下为GetUserList)?我确定我可以使用 jquery 将 GetUserList 添加到网格中的所有链接,但我相信这应该是一种更好的方法。
也有可能是我做错了,谢谢你的建议。
【问题讨论】:
标签: asp.net-mvc-3 webgrid