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