aspnetpager 删除_AspNetPager 删除_aspnetpager

1个回答

写回答

Inging

2024-09-19 14:00

+ 关注

word
word

如题,我用post传值方式搜索后里用AspNetPager来分页(两种模式:一种是AspNetPager不显示?page参数,另一种是Url分页即带参数?page=),我贴出我的代码:protectedvoidPage_Load(objectsender,EventArgse){if(!IsPostBack){BindListData();BindHot();}}///<summary>///数据绑定--初始化///</summary>privatevoidBindListData(){DataSetds1=NewsBll。

GetList("*""TitleLike’%"+Request。Form["txtKeyword"]。Trim()+"%’""IDDESC");//这里返回个DataSet,问题:显示我第二页显示的时候Request。

Form["txtKeyword"]为空了,取的的数据条件就是like’%%’所有数据的第二页了,这是不显示?page参数的分页方式。aspnetpager带参数page的呢,又如何处理?请指教AspNetPager1。

RecordCount=ds1。Tables[0]。Rows。Count;Session["dvlist"]=ds1。Tables[0]。DefaultView;bindData();}///<summary>///数据绑定///</summary>privatevoidbindData(){if(ZsRequest。

GetInt("page"0)==0)//ZsRequest类无须关注,我用来接收参数的一个封装类相当于Request。QueryString("page"){CurrentPage=1;}else{CurrentPage=Convert。

ToInt32(ZsRequest。GetString("page"));}PagedDataSourcepds=newPagedDataSource();pds。AllowPaging=true;pds。PageSize=AspNetPager1。

PageSize;pds。CurrentPageIndex=CurrentPage-1;pds。DataSource=(DataView)Session["dvlist"];RPNewsList。DataSource=pds;RPNewsList。

DataBind();}protectedvoidAspNetPager1_PageChanged(objectsender,EventArgse){bindData();}我下面还有第二种写法,虽然不带page的分页功能实现了,但还是有个问题:当点击第二页时关键字的搜索我要在页面上显示,却显示不了,很显然是点击第二页时Request。

Form["txtKeyword"]为空了conststringvsKey="searchCriteria"//ViewStatekey。

举报有用(17分享收藏

Copyright © 2025 IZhiDa.com All Rights Reserved.

知答 版权所有 粤ICP备2023042255号