public ActionResult Index()
{
return View(GetStudetPage());
}
[HttpPost]
public ActionResult Index(string StuName, DateTime? StuKTime, DateTime? StuJTime)
{
string where = "1=1";
if (StuName != null)
{
where += "and StuName like ‘%" + StuName + "%‘";
}
if (StuKTime != null)
{
where += " and StuKTime > ‘" + StuKTime + "‘";
}
if (StuJTime != null)
{
where += " and StuJTime <‘" + StuJTime + "‘";
}
Where = where;
return PartialView("_PartialPage1", GetStudetPage());
}
static int PageSize = 3;
static int PageIndex = 1;
static string Where = "";
public List<stuclass> GetStudetPage()
{
PageParams pargePar = new PageParams
{
TableName = "Student",
IndexCol = "StuID",
PageSize = PageSize,
PageIndex = PageIndex - 1,
OrderCol = "StuID asc",
Where = Where,
Columns = "*"
};
Pages<stuclass> pages = bl.GetStudetPage(pargePar);
ViewBag.SumCount = pages.SumCount;
ViewBag.SumPage = pages.SumCount;
ViewBag.PageIndex = PageIndex;
return pages.list;
}
[HttpPost]
public ActionResult Page(int index)
{
PageIndex = index;
return PartialView("_PartialPage1", GetStudetPage());
}
原文地址:https://www.cnblogs.com/fsl123/p/9387600.html