private void createpaging()
    {
        DataTable dt = new DataTable();

        dt.Columns.Add("PageIndex");
        dt.Columns.Add("PageText");
        findex = CurrentPage - 10;
        if (CurrentPage >= 9)
        {
            lindex = CurrentPage + 10;
        }
        else
        {
            lindex = 10;
        }
        if (lindex > Convert.ToInt32(ViewState["totalpage"]))
        {
            lindex = Convert.ToInt32(ViewState["totalpage"]);
            findex = lindex - 10;
        }
        if (findex < 0)
        {
            findex = 0;
        }
        for (int i = findex; i < lindex; i++)
        {
            DataRow dr = dt.NewRow();
            dr[0] = i;
            dr[1] = i + 1;
            dt.Rows.Add(dr);
        }
        DataListPaging.DataSource = dt;
        DataListPaging.DataBind();
    }
Esempio n. 2
0
 private void createpaging()
 {
     lock (thisLock)
     {
         try{
             DataTable dt = new DataTable();
             dt.Columns.Add("PageIndex");
             dt.Columns.Add("PageText");
             findex = CurrentPage - 5;
             if (CurrentPage >= 4)
             {
                 lindex = CurrentPage + 10;
             }
             else
             {
                 lindex = 5;
             }
             if (lindex > Convert.ToInt32(ViewState["totalpage"]))
             {
                 lindex = Convert.ToInt32(ViewState["totalpage"]);
                 findex = lindex - 10;
             }
             if (findex < 0)
             {
                 findex = 0;
             }
             for (int i = findex; i < lindex; i++)
             {
                 DataRow dr = dt.NewRow();
                 dr[0] = i;
                 dr[1] = i + 1;
                 dt.Rows.Add(dr);
             }
             DataListPaging.DataSource = dt;
             DataListPaging.DataBind();
         } catch (Exception ex)
         {
             ExceptionLogging.SendExcepToDB(ex);
         }
     }
 }