Repeater + PagedDataSource 分页返回如何实现呢?

问题描述

前情提要:我已经使用Repeater+PagedDataSource已经实现分页了,一切正常问题描述:假如一共有5页,我已经查看到了第3页,现在发现有一条数据出错了,就进行编辑(在本地窗口,打开编辑页面,而不是弹出窗口)编辑完之后,我返回的时候,如何返到第3页呢

解决方案

解决方案二:
编辑的时候把页码带过去,返回的时候根据页码返回
解决方案三:
有没有详细一点的资料呢
解决方案四:
我在网页上放置了一个页码的label。绑定时时候:intcurPage=Convert.ToInt32(this.Label1.Text);ps.CurrentPageIndex=curPage-1;下面粘上我的代码:privatevoiddataBindToDatelist(){stringsqlstr;stringfswhere="";sqlstr="select*fromabcwhereid<>0";SqlConnectioncon=db.CreateCon();con.Open();SqlDataAdaptersda=newSqlDataAdapter();sda.SelectCommand=newSqlCommand(sqlstr,con);DataSetds=newDataSet();this.Eventtable.DataKeyField="id";sda.Fill(ds,"eventrec");intcurPage=Convert.ToInt32(this.Label1.Text);//label1是页码PagedDataSourceps=newPagedDataSource();ps.DataSource=ds.Tables["eventrec"].DefaultView;ps.AllowPaging=true;ps.PageSize=6;ps.CurrentPageIndex=curPage-1;Eventtable.DataSource=ps;Eventtable.DataBind();l_count.Text=ps.DataSourceCount.ToString();con.Close();}
解决方案五:
引用1楼Sandy945的回复:

编辑的时候把页码带过去,返回的时候根据页码返回

这是我的分页代码,请问如何将页码带过去呢publicvoidPaginationBind(){intmyCurrentPage=Convert.ToInt32(this.lblCurrentPage.Text);//当前页stringmySql="select*fromMac_EmployeeorderbyEmployeeIDdesc";DataSetmySet=GetMySet(mySql);PagedDataSourcemySource=newPagedDataSource();mySource.DataSource=mySet.Tables[0].DefaultView;mySource.AllowPaging=true;mySource.PageSize=3;mySource.CurrentPageIndex=myCurrentPage-1;this.lnkbtnFirst.Enabled=true;this.lnkbtnPre.Enabled=true;this.lnkbtnNext.Enabled=true;this.lnkbtnLast.Enabled=true;if(myCurrentPage==1){this.lnkbtnFirst.Enabled=false;this.lnkbtnPre.Enabled=false;}if(myCurrentPage==mySource.PageCount){this.lnkbtnNext.Enabled=false;this.lnkbtnLast.Enabled=false;}this.lblAllPage.Text=mySource.PageCount.ToString();this.Repeater1.DataSource=mySource;this.Repeater1.DataBind();}
解决方案六:
自已顶一下。

时间: 2024-09-18 22:50:00

Repeater + PagedDataSource 分页返回如何实现呢?的相关文章

在ASP.NET 2.0中操作数据之四十一:DataList和Repeater数据分页_自学过程

导言 分页和排序是显示数据时经常用到的功能.比如,在一个在线书店里搜索关于ASP.NET 的书的时候,可能结果会是成百上千,而每页只列出十条.而且结果可以根据title(书名),price(价格),page count(页数),author name(作者)等来排序.我们在分页和排序报表数据 里已经讨论过, GridView, DetailsView, 和FormView 都有内置的分页功能,仅仅只需要勾一个checkbox就可以开启.GridView 还支持内置的排序. 不幸的是,DataLi

asp.net repeater 数字分页代码

asp教程.net repeater 数字分页代码 public static string sort { set; get; }     private static string strsql;     sqlconnection con = new sqlconnection("server=localhost;database=moldsystem;uid=sa;pwd=sa");//这个是全局变量         private pageddatasource pds()  

ASP.NET程序中用Repeater实现分页

asp.net|程序|分页 一.程序功能:为Repeater实现分页 二.窗体设计: 1.新建ASP.NET Web应用程序,命名为Repeater2,保存路径为http://192.168.0.1/Repeater2(注:我机子上的网站的IP是192.168.0.1的主目录是D:\web文件夹)然后点击确定. 2.向窗体添加一个3行一列的表,向表的第一行中添加一个Repeater控件,向表的第二行中添加两个Label控件向表的第三行中添加四个Button按钮. 3.切换到HTML代码窗口,在<

aged ata ource 分页-获得PagedDataSource分页的第一行数据

问题描述 获得PagedDataSource分页的第一行数据 用PagedDataSource绑定repteater做的分页,但是前台显示的时候第一条数据的样式和下边的都不一样,怎么办? 这样的分页能获得他每一页的第一行数据吗,可以移除这行数据吗 或者实现首行样式不同的方法还有其他吗?

ASP.NET程序中用Repeater实现分页_自学过程

一.程序功能: 为Repeater实现分页 二.窗体设计: 1.新建ASP.NET Web应用程序,命名为Repeater2,保存路径为http://192.168.0.1/Repeater2(注:我机子上的网站的IP是192.168.0.1的主目录是D:\web文件夹)然后点击确定. 2.向窗体添加一个3行一列的表,向表的第一行中添加一个Repeater控件,向表的第二行中添加两个Label控件向表的第三行中添加四个Button按钮. 3.切换到HTML代码窗口,在<asp:Repeater

关于Repeater的分页问题

问题描述 publicvoidFengye(){DataAccess.Class1dac=newDataAccess.Class1();DataSetds=newDataSet();ds=dac.GetData();PagedDataSourcepds=newPagedDataSource();pds.DataSource=ds.Tables[0].DefaultView;pds.AllowPaging=true;pds.PageSize=3;pds.CurrentPageIndex=Conve

ASP.NET 2.0数据教程之四十四:DataList和Repeater数据分页

返回"ASP.NET 2.0数据教程目录" 导言 分页和排序是显示数据时经常用到的功能.比如,在一个在线书 店里搜索关于ASP.NET 的书的时候,可能结果会是成百上千,而每页只列出十条 .而且结果可以根据title(书名),price(价格),page count(页数), author name(作者)等来排序.我们在分页和排序报表数据 里已经讨论过, GridView, DetailsView, 和FormView 都有内置的分页功能,仅仅只需要勾一个 checkbox就可以开启

Repeater 的分页问题

问题描述 <asp:PanelID="Panel1"runat="server"Width="900px"><asp:LabelID="Label1"runat="server"Text="开始时间"style="font-size:12px;padding:0px5px0px0px;"></asp:Label><asp:Te

asp.net PagedDataSource分页实现代码

   private void databind(ilist<loginlog> datasource,int count)     {         pageddatasource pds = new pageddatasource();         pds.datasource = datasource;         pds.allowpaging = true;         pds.pagesize = 10;         pds.currentpageindex =