PagePrams
Posted yanyuhao
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了PagePrams相关的知识,希望对你有一定的参考价值。
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;
}
以上是关于PagePrams的主要内容,如果未能解决你的问题,请参考以下文章