Asp.net加入参数的URL字符串 [英] Asp.net adding parameter to url string

查看:77
本文介绍了Asp.net加入参数的URL字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在一个页面中显示过滤的项目清单,而现在我要限制由分页的结果显示。

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

所以,如果我有URL参数像这样的:

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 

如果没有参数:

?pagenum=5

TNX提前!

推荐答案

有关服务器端

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.

这篇关于Asp.net加入参数的URL字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆