How to slice paging for every 5 pages

I just want to slice paging every 5 pages because there are too many pages that's why the paging of the bottom looks too crowded.

        int kategoriId = Convert.ToInt32(Request.QueryString["ID"]);

        using (HEDataContext db = new HEDataContext())
        {

            var productList = (from p in db.KATEGORI_03s
                              where p.kategori_02_id == kategoriId
                              select new 
                              {
                                ID= p.ID,
                                Name = p.Name,                                    
                                Bilgi = p.Bilgi,
                                Img1 = p.Img1,
                                Img2 = p.Img2,
                                Count = db.KATEGORI_03s.Count()
                              }).Skip(pg * 9).Take(take);


            PagedDataSource page = new PagedDataSource();
            page.AllowCustomPaging = true;
            page.AllowPaging = true;
            page.DataSource = productList;
            page.PageSize = 9;

            DLProductsList.DataSource = productList;
            DLProductsList.DataBind();

            if (!IsPostBack)
            {
                CreatePagingControl();
            }

        }




    public void CreatePagingControl()
    {

        int totalPageCount = (CountTable() / 9) + 1;
        int ID = Convert.ToInt32(Request.QueryString["ID"]);
        int pg = Convert.ToInt32(Request.QueryString["pg"]);
        int kategori_01_id = Convert.ToInt32(Request.QueryString["kategori_01_id"]);

        string lnk = "";

        for (int i = 0; i < (CountTable() / 9) + 1; i++){


            if (pg == 0)
            {
                firstpage.Visible = false;
                previous.Visible = false;
            }


            if (pg == (totalPageCount - 1))
            {
                next.Visible = false;
                lastpage.Visible = false;
            }


            firstpage.NavigateUrl = "Products-List.aspx?kategori_01_id=" + kategori_01_id + "&ID=" + ID + "&pg=0";
            previous.NavigateUrl = "Products-List.aspx?kategori_01_id=" + kategori_01_id + "&ID=" + ID + "&pg=" + (pg - 1).ToString();
            next.NavigateUrl = "Products-List.aspx?kategori_01_id=" + kategori_01_id + "&ID=" + ID + "&pg=" + (pg + 1).ToString();
            lastpage.NavigateUrl = "Products-List.aspx?kategori_01_id=" + kategori_01_id + "&ID=" + ID + "&pg=" + (totalPageCount - 1).ToString();


            if (i == pg)  
                lnk += "<span>" + (i + 1).ToString() + "</span>";
            else
                lnk += "<a href='Products-List.aspx?kategori_01_id=" + kategori_01_id + "&ID=" + ID + "&pg=" + i.ToString() + "'>" + (i + 1).ToString() + "</a>";


            lnk += "&nbsp;<img src='images/paging-pipe.gif' class='pagingpipe' alt='' />&nbsp;";

        }

        lblPageName.Text = lnk;

    }

Answers


That's a pretty common problem, you can do this using a jQuery widget like this one below here

You just need to provide the back-end implementation to fetch the data you require.


Need Your Help

Profiling Windows Workflow Services

profiling workflow-foundation workflowservice dotcover

What should I do to profile worflows exposed as Windows Workflow services? Which tool did you use?