求助,关于AspNetPager分页问题
本帖最后由 zx_001 于 2013-07-05 18:45:19 编辑 我用AspNetPager实现了分页,现在要进行伪静态,但是页面有几个DropDownList来对查询出来的结果进行筛选,查询出来的数据能够正常分页并伪静态,但是进行筛选后就伪静态就失效了,
<webdiyer:AspNetPager ID="AspNetPager1" runat="server" CssClass="paginator" CurrentPageButtonClass="cpb" CurrentPageButtonPosition="Center"
NextPageText="下一页" PrevPageText="上一页" ShowInputBox="always" PageSize="5" LastPageText="未页" FirstPageText="首页" NumericButtonCount="10"
onpagechanging="AspNetPager1_PageChanging"></webdiyer:AspNetPager>
public void BindPage(int current, string strWhrs)
{
messs.InnerHtml = mess;
int number;
if (strWhrs == null)
{
strWhrs = " IsLock=0 and L_Type=1 ";
}
number = bll.GetCount(strWhrs);//获取数据的总数
if (number == 0)
{
tishi.Style["display"] = "block";
tishi.InnerText = "很抱歉,暂无数据!";
}
else
{
tishi.Style["display"] = "none";
}
AspNetPager1.RecordCount = number;
int begin = (current - 1) * AspNetPager1.PageSize;
int size = AspNetPager1.PageSize;
this.AspNetPager1.EnableUrlRewriting = true;
if (_classid !=null)
{
this.AspNetPager1.UrlRewritePattern = "/exchange/list-" + _classid + "-{0}.html";
}
else
{
this.AspNetPager1.UrlRewritePattern = "/exchange/{0}.html";
}
rptlinklist.DataSource = bll.GetPageList(size, begin, strWhrs, " L_Kz desc");
rptlinklist.DataBind();
}
protected void AspNetPager1_PageChanging(object src, Wuqi.Webdiyer.PageChangingEventArgs e)
{
BindPage(e.NewPageIndex, (string)ViewState[vskey]);
}
例如原来的URL为newsList.aspx?newsId=12345重写为newsList_123456.html
设置UrlRewritePattern属性为:newslist_%newsId%/{0}然后在重写规则里再添加一个
<RewriterRule>
<LookFor>~/news/newslist_(\d+)/(\d+)</LookFor>
<SendTo><![CDATA[~/news/newslist.aspx?newsId=$1&page=$2]]></SendTo>
</RewriterRule>
规则中的page就是aspnetpager控件得UrlPageIndexName属性的值
[解决办法]