public ActionResult ProjectSurvey(int? Page, string Param, FormCollection FormData) { Dictionary<string, string> sitemaster = GetSiteMaster(); ViewData["SiteMaster"] = sitemaster; int PageNo = Page ?? 1; int PageSize = 10; int DataCount = 0; Dictionary<string, string> FormDict = ParmHelper.Analysis(FormData); ProjectDao ProjectD = new ProjectDao(); ViewData["UserId"] = sitemaster["userid"]; if (FormDict.Count == 0 && Param == null) { IList<IDictionary> DataList = ProjectD.DataList<IDictionary>(PageNo, PageSize, out DataCount, null); PagedList<IDictionary> PageList = new PagedList<IDictionary>(DataList, PageNo, PageSize, DataCount); ViewData["DataCount"] = DataCount; return View(PageList); } //如果有查询参数了 if (FormDict.Count == 0 && Param != null) { Dictionary<string, string> Dict = ParmHelper.AnalysisParm(Param); IList<IDictionary> DataList = ProjectD.DataList<IDictionary>(PageNo, PageSize, out DataCount, Dict); PagedList<IDictionary> PageList = new PagedList<IDictionary>(DataList, PageNo, PageSize, DataCount); ViewData["Form"] = Dict; ViewData["DataCount"] = DataCount; return View(PageList); } else { //把表单转为参数 if (FormDict.Count != 0) { string Parameter = ParmHelper.BuildParm(FormDict); return RedirectToAction("ProjectSurvey", new { Page = 1, Param = Parameter }); } } return View(); }