// // GET: /Adopt/ /// <summary> /// 获取领养宠物信息 /// </summary> /// <param name="pageIndex">当前页码</param> /// <param name="limit">每页显示条数</param> /// <returns></returns> public JsonResult Index(int pageIndex, int limit) { AdoptPet adoption = new AdoptPet(); PagingModel <WebCommonModel> _pageKnowledge = new PagingModel <WebCommonModel>(); List <WebCommonModel> commonList = new List <WebCommonModel>(); List <CVAdoptPet> adoptList = new List <CVAdoptPet>(); //获取总页数 int count = 0; try { adoptList = adoption.GetPetAdoptPerPageList(pageIndex, limit, out count); commonList = CommonDao.DataTransferToAdoptionWebCommonModelList(adoptList); _pageKnowledge.total = count; _pageKnowledge.records = commonList; } catch (Exception ex) { throw ex; } return(Json(_pageKnowledge, JsonRequestBehavior.AllowGet)); }
private void BindGridNew(int pageNumber) { int perPage = CPetCareConfiguration.PetPerPageNumbers; AdoptPet adopt = new AdoptPet(); int howmany = 0; GridView1.DataSource = adopt.GetPetAdoptPerPageList(pageNumber, perPage, out howmany); GridView1.DataKeyNames = new string[] { "AdoptID" }; int howmanyPages = 0; howmanyPages = int.Parse(Math.Ceiling((double)howmany / (double)perPage).ToString()); List <int> list = new List <int>(); for (int a = 1; a <= howmanyPages; a++) { list.Add(a); } ddPages.DataSource = list; ddPages.DataBind(); GridView1.DataBind(); }
private void BindGridNew(int pageNumber) { int perPage = CPetCareConfiguration.PetPerPageNumbers; AdoptPet adopt = new AdoptPet(); int howmany = 0; GridView1.DataSource = adopt.GetPetAdoptPerPageList(pageNumber, perPage, out howmany); GridView1.DataKeyNames = new string[] { "AdoptID"}; int howmanyPages = 0; howmanyPages = int.Parse(Math.Ceiling((double)howmany / (double)perPage).ToString()); List<int> list = new List<int>(); for(int a=1;a<=howmanyPages;a++) { list.Add(a); } ddPages.DataSource = list; ddPages.DataBind(); GridView1.DataBind(); }