Esempio n. 1
0
    private void BindPageIndex()
    {
        int num    = res.GetAllNumResStuBYTutorID(tutorid);
        int infact = (num + pagesize - 1) / pagesize;//总共的页数

        allpage.InnerText = infact.ToString();
        int npgeindex = int.Parse(nowpageindex.InnerText);
        int npnum     = int.Parse(nowpagenum.InnerText);

        if (5 * npgeindex < infact)     ///5是显示的页数
        {
            for (int i = 0; i < 6; i++) // 初始化都出现
            {
                string aid  = "a_";
                int    real = i % 6 == 0 ? 6 : i % 6;
                paginate.FindControl(aid + real).Visible = true;
            }
        }
        else
        {
            int dif = 5 * npgeindex - infact;
            for (int i = 6 - dif; i <= 5; i++)
            {
                string aid  = "a_";
                int    real = i % 5 == 0 ? 5 : i % 5;
                paginate.FindControl(aid + real).Visible = false;
            }
            paginate.FindControl("a_6").Visible = false;
        }
    }