Exemplo n.º 1
0
        protected void Button3_Click(object sender, EventArgs e)
        {
            int pageNumb =int.Parse( TextBox2.Text.Trim().ToString());
            int pagePerPage = CPetCareConfiguration.PetPerPageNumbers;

            List<CVKnowledgePet> list = new List<CVKnowledgePet>();
            KnowledgePet knowleget = new KnowledgePet();
            int howmanyPages = 0;
            list = knowleget.GetPetKnowledgePerPageList(pageNumb, pagePerPage,out howmanyPages);
            GridView1.DataSource = list;
            GridView1.DataBind();
        }
Exemplo n.º 2
0
 //
 // GET: /Knowledge/
 /// <summary>
 /// 获取宠物知识的信息
 /// </summary>
 /// <param name="pageIndex">当前页码</param>
 /// <param name="limit">每页的显示条数</param>
 /// <returns></returns>
 public JsonResult Index(int pageIndex,int limit)
 {
     KnowledgePet knowledge = new KnowledgePet();
     PagingModel<WebCommonModel> _pageKnowledge = new PagingModel<WebCommonModel>();
     List<WebCommonModel> commonList = new List<WebCommonModel>();
     List<CVKnowledgePet> knowledgeList = new List<CVKnowledgePet>();
     //获取总页数
     int count = 0;
     try
     {
         knowledgeList = knowledge.GetPetKnowledgePerPageList(pageIndex,limit,out count);
         commonList = CommonDao.DataTransferToKnowledgeWebCommonModelList(knowledgeList);
         _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;
            List<CVKnowledgePet> list = new List<CVKnowledgePet>();
            KnowledgePet knowleget = new KnowledgePet();
            int howmany = 0;
            list = knowleget.GetPetKnowledgePerPageList(pageNumber, perPage, out howmany);
            GridView1.DataSource = list;
            GridView1.DataKeyNames = new string[] { "KnowledgeID"};
            GridView1.DataBind();
            int howmanyPages = 0;

            howmanyPages = int.Parse(Math.Ceiling((double)howmany / (double)perPage).ToString());
            List<int> listPage = new List<int>();
            for (int b = 1; b <= howmanyPages; b++)
            {
                listPage.Add(b);
            }
            ddPage.DataSource = listPage;
            ddPage.DataBind();
        }