using System; using System.Collections; using System.Configuration; using System.Data; //using System.Linq; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; //using System.Xml.Linq; namespace Com.Jpsoft.Hospital.Web.Module.rs_ksdm { public partial class List : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { int iCurPage = 1; Com.Jpsoft.Hospital.Web.Common.BasePage.FetchQueryString("LCurPage", out iCurPage); AspNetPager1.RecordCount = iCurPage * AspNetPager1.PageSize; AspNetPager1.CurrentPageIndex = iCurPage; BindData(); } } private void BindData() { int RecordCount = 0; string strWhere = " where 1=1 "; if (!string.IsNullOrEmpty(this.txtksmc.Text)) { strWhere += " and ksmc like '%" + this.txtksmc.Text + "%' "; } string strOrder = " order by ksdm DESC"; Com.Jpsoft.Hospital.BLL.Ex.rs_ksdmEx bll = new Com.Jpsoft.Hospital.BLL.Ex.rs_ksdmEx(); using (IDataReader idr = bll.SelectPage(AspNetPager1.CurrentPageIndex, AspNetPager1.PageSize, strWhere, strOrder)) { if (idr.Read()) { RecordCount = Convert.ToInt32(idr["RecordCount"]); } idr.NextResult(); GridView1.DataSource = idr; GridView1.DataBind(); } this.AspNetPager1.RecordCount = RecordCount; } protected void Button1_Click(object sender, EventArgs e) { this.AspNetPager1.CurrentPageIndex = 0; BindData(); } protected void AspNetPager1_PageChanged(object sender, EventArgs e) { BindData(); } } }