潜力博客

人生的最大遗憾莫过于错误地坚持了不该坚持的,轻易地放弃了不该放弃的...

« 无法下载Silverlight应用程序,请查看Web服务器设置解决方法图片另存为只能为bmp格式的解决办法 »

使用AspNetPager控件多个参数Url重写功能问题

       AspNetPager控件设置简单方便,性能也可以,经常使用AspNetPager来分页,本次使用AspNetPager重写多个参数时,按照控件上的说明

设置URL的重写格式,老是没有传值成功,最后仔细看了AspNetPager控件源码里的帮助文档,才发现除Page以外的参数,设置格式:%参数名%
 
,必须要和原始Url的参数名相同,控件上没特别说明,我正是忽略这点,发了很多时间调试。
再拿个简单的例子说明下:
原始Url:http://www.xxx.com/articlelist.aspx?type=aspnet&page=2
重写Url:http://www.xxx.com/articlelist/aspnet_2.htm
 
下面是aspx页面设置:
 
<webdiyer:AspNetPager ID="AspNetPager1" runat="server" AlwaysShow="true"  
                PageSize="20" onpagechanging="AspNetPager1_PageChanging" FirstPageText="首页"  
                LastPageText="尾页" NextPageText="下一页" PrevPageText="上一页" UrlPaging="True" 
                ShowFirstLast="False" ShowPageIndexBox="Never"  EnableUrlRewriting="True" UrlRewritePattern="/articlelist/%
 
type%_{0}.htm" ></webdiyer:AspNetPager>
 
要注意的是:UrlRewritePattern="/articlelist/%type%_{0}.htm" 规则中的%type%,就是原始Url中的参数名type,设置相同即可。
 
  • 相关文章:

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

Search

Categories

Previous

Comments

Archives

Copyright © 2008 潜力博客 All Rights Reserved.粤ICP备08117954号
Powered By Z-Blog Designed by Han'space