Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/multithreading/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 在ASP.NET MVC中显示分页的数据网格时出错_C#_Asp.net Mvc 2 - Fatal编程技术网

C# 在ASP.NET MVC中显示分页的数据网格时出错

C# 在ASP.NET MVC中显示分页的数据网格时出错,c#,asp.net-mvc-2,C#,Asp.net Mvc 2,我正在尝试创建一个分页的数据网格,并使用代码部分 public ActionResult Paged(int page , int pageSize) { var model = new UserGridModel() { CurrentPageIndex = page, PageSize = pageSize }; // Determine the total number of users being paged through (neede

我正在尝试创建一个分页的数据网格,并使用代码部分

public ActionResult Paged(int page , int pageSize)
{
   var model = new UserGridModel()
   {
      CurrentPageIndex = page,
      PageSize = pageSize
   };

   // Determine the total number of users being paged through (needed to compute PageCount)
   model.TotalRecordCount = this.DataContext.users.Count();

   // Get the current page of users
   //model.CurrentPageIndex = this.DataContext.users.Skip((model.CurrentPageIndex - 1) * model.PageSize).Take(model.PageSize);
   model.users = this.DataContext.users
                     .Skip((model.CurrentPageIndex - 1) * model.PageSize)
                     .Take(model.PageSize);

   return View(model);
}
问题是

错误2“New.Models.UserGridModel”不包含的定义 “users”和无扩展方法“users”接受的第一个参数为 类型


有什么办法解决这个问题吗

我想你需要添加更多信息。我没有看到错误和代码片段之间有任何关联。