
word
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。
Copyright © 2025 IZhiDa.com All Rights Reserved.
知答 版权所有 粤ICP备2023042255号