Click here to Skip to main content
15,887,267 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
HI,
C#
RowCount = query.First().Count;
for (int i = 0; i < (RowCount / 10) + 1; i++)
{
   LinkButton lnk = new LinkButton();
   lnk.Click += new EventHandler(lbl_Click);
   lnk.ID = "lnkPage" + (i + 1).ToString();
   lnk.Text = (i + 1).ToString();
   plcPaging.Controls.Add(lnk);
   Label spacer = new Label();
   spacer.Text = " ";
   plcPaging.Controls.Add(spacer);
}

by using am diaplaying all the page numbers but i want to limit the page number display to 10 and when i clcik next button i should get remaing pages if exist
Posted
Updated 24-May-14 3:13am
v5
Comments
Bernhard Hiller 19-May-14 2:32am    
Wow, what a similarity to http://www.codeproject.com/Questions/774387/In-Pagination-Using-Repeator-I-Wan-To-Display-Only
Do you expect us to write all of the program for you. What have YOU done so far?

C#
int maxrecords = 10;
          int totalrec = 100;
          int pg = 10;
          int curpage = 0;
          string RBT = "Events";
          if (Request.Params.Get("pageid") != null)
              curpage = Convert.ToInt32(Request.Params.Get("pageid").ToString());
          if (Request.Params.Get("toshow") != null)
              RBT = Request.Params.Get("toshow").ToString();
          if (pg < curpage)
              curpage = pg;

          int totpage = totalrec / maxrecords;
          if (totalrec % maxrecords != 0)
              totpage = totpage + 1;
          int pageid = (maxrecords * pg) + 1;

          string paginator = string.Empty;
          if (curpage > 0)
              paginator = "<a href='/urpath/" + RBT + "/" + (curpage - 1) + "/index.htm' class='link1'><img src='/images/previous-bt.gif' alt='Prev' align='absmiddle'/></a>";

          for (int i = 0; i < totpage; i++)
          {
              if (curpage == i)
              { paginator += "  " + (i+1); }
              else
                  paginator += " <a href='/urpath/" + RBT + "/" + i + "/index.htm' class='link1'> " + (i + 1) + "</a>";
          }

          if (curpage < totpage-1)
              paginator += " <a href='/urpath/" + RBT + "/" + (curpage + 1) + "/index.htm' class='link1'><img src='/images/next-bt.gif' alt='Next' align='absmiddle' /></a>";
          Response.Write(paginator);


use inline coding it will be easier..
and for data base u can use PagedDataSource will make it easier ;)
Hope this helps
 
Share this answer
 
v2
try to googling your self.. :)
there are About 87,200 results (0.29 seconds)

Here are some links , may be useful for you.. :)

Custom Paging with the ASP.NET Repeater Control
[^]

Paging with Repeater control in ASP.NET[^]

Allow Paging in Repeater and DataList Using C# [^]

Repeater with Paging and Sorting Features[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900