欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

AspNetPager分页控件UrlRewritePattern参数设置的重写代码

程序员文章站 2024-03-31 17:49:16
复制代码 代码如下:

复制代码 代码如下:

<aspnet:aspnetpager id="asppages" runat="server" custominfohtml="第%currentpageindex%/%pagecount%页,每页%pagesize%条,共%recordcount%条"
                            firstpagetext="首页" lastpagetext="尾页" nextpagetext="下一页" alwaysshow="true" cssclass="pp"
                            currentpagebuttonclass="cpb" pageindexboxtype="dropdownlist" prevpagetext="上一页"
                            showcustominfosection="left" showpageindexbox="never" submitbuttontext=" go "
                            textafterpageindexbox="页" pagesize="10" textbeforepageindexbox="转到" height="25px"
                            numericbuttoncount="4" width="98%" centercurrentpagebutton="true" custominfotextalign="left"
                            horizontalalign="right" onpagechanged="asppages_pagechanged"
                urlrewritepattern="/knowledge/tag/%tagid%/%category%/pv{0}" urlpaging="true" enableurlrewriting="true">
   </aspnet:aspnetpager>

 


protected void asppages_pagechanged(object sender, eventargs e)
{
string tagid = getrequest.getstring("tagid");
asppages.urlrewritepattern = string.isnullorempty(tagid) ? "/knowledge/tag/%tagid%/%category%/pv1" : "/knowledge/tag/%tagid%/%category%/pv{0}";
bindrptchateau(tagid);
}
<rewrite url="^/knowledge/tag/(\d+)/(\d+)/pv(\d+)$" to="~/search/searchknowledgetag.aspx?keywords=$1&tagid=$1&category=$2&page=$3" processing="stop"></rewrite>