日期:2014-05-18 浏览次数:20442 次
/// <summary> /// DataList翻页程序 /// </summary> private void DisplayBySection() { this.dlDoctor.Dispose(); string SectionID = Request.Params.Get("SectionID"); string strSectionID; if(SectionID!=null) { strSectionID = "select * from Doctors,Sections,BigSections,DoctorType "+ "where Sections.BigSectionID = BigSections.BigSectionID and Sections.SectionID = Doctors.SectionID "+ "and Doctors.DoctorTypeID = DoctorType.DoctorTypeID and DoctorType.DoctorTypeName='祖传医师'"+ "and Doctors.SectionID = '"+SectionID+"'"; } else { strSectionID = "select * from Doctors,Sections,BigSections,DoctorType "+ "where Doctors.SectionID = Sections.SectionID and BigSections.BigSectionID = Sections.BigSectionID and "+ "Doctors.DoctorTypeID=DoctorType.DoctorTypeID and DoctorType.DoctorTypeName='祖传医师' order by DoctorID"; } this.dlDoctor.Dispose(); try { DataSet dsDoctor = PubClass.DbOperate.ExecuteSqlDataAdapter(strSectionID); //使用页面内置的数据源PagedDataSource(具有翻页功能) PagedDataSource objPage = new PagedDataSource(); objPage.DataSource = dsDoctor.Tables[0].DefaultView; objPage.AllowPaging =true; objPage.PageSize = 9; int curPage; if(Request.QueryString["Page"]!=null) { curPage = Int32.Parse(Request.QueryString["Page"].ToString()) ; } else { curPage = 1; } objPage.CurrentPageIndex = curPage -1; //lblCurPage为显示当前页的Lable控件 lblCurPage.Text = "当前页: 第"+curPage.ToString()+"页"; if(!objPage.IsFirstPage) { this.lnkPrev.NavigateUrl = Request.CurrentExecutionFilePath+"?Page="+Convert.ToString(curPage-1); } if(!objPage.IsLastPage) { this.lnkNext.NavigateUrl = Request.CurrentExecutionFilePath+"?Page="+Convert.ToString(curPage+1); } this.dlDoctor.DataSource = objPage; this.dlDoctor.DataBind(); } catch(Exception Err) { Response.Write(PubClass.CommonTool.PopShow(Err.Message)); } }
------解决方案--------------------
翻页再一次邦定DataList1
------解决方案--------------------
点击下一页需要重新绑定数据
------解决方案--------------------
DataList翻页2008-01-09 14:27protected 关于asp.net的Main()方法有关问题