9

I'm displaying a list of filtered items in a page, and now I have to limit the displaying by paginating the results.

So if I have url parameters like these:

example.com/?category=pizza&period=today

where both category and period can also not being showed:

example.com/?period=today

example.com/

how can I add a "Next page" in the end that keeps any previous parameter and adds

&pagenum=5 

or if there are no parameters:

?pagenum=5

Tnx in advance!

jdphenix
  • 13,519
  • 3
  • 37
  • 68
Attila
  • 692
  • 1
  • 12
  • 30

2 Answers2

15

For serverside

string url = Request.Url.GetLeftPart(UriPartial.Path);
url += (Request.QueryString.ToString() == "" ) ? "?pagenum=1" : "?" + Request.QueryString.ToString() + "&pagenum=1";

You can pass in the page number depending on how you are handling this.

Tim B James
  • 19,595
  • 4
  • 68
  • 96
-1

For ASP.Net use the following:

string temp = Request.QueryString["yourParamName"];

Fissh

gadildafissh
  • 1,745
  • 1
  • 16
  • 19