public void loadSchools() { DAL myDal = new DAL(conn); adsource = new PagedDataSource(); myDal.AddParam("@schoolCrud", "r"); DataSet ds = myDal.ExecuteProcedure("spSchoolsCrud"); adsource.DataSource = ds.Tables[0].DefaultView; adsource.PageSize = 2; adsource.AllowPaging = true; adsource.CurrentPageIndex = pos; BtnFirst.Enabled = !adsource.IsFirstPage; BtnPrevious.Enabled = !adsource.IsFirstPage; BtnLast.Enabled = !adsource.IsLastPage; BtnNext.Enabled = !adsource.IsLastPage; DlSchools.DataSource = adsource; DlSchools.DataBind(); }
protected void BtnSearch_Click(object sender, EventArgs e) { string TypeId = DdlTypeOfSchool.SelectedItem.Value; string LocationId = DdlLocation.SelectedItem.Value; DAL myDal = new DAL(conn); adsource = new PagedDataSource(); myDal.AddParam("@schoolCrud", "r"); myDal.AddParam("@schTypeId", TypeId); myDal.AddParam("@locationId", LocationId); DataSet ds = myDal.ExecuteProcedure("spSchoolsCrud"); adsource.DataSource = ds.Tables[0].DefaultView; adsource.PageSize = 2; adsource.AllowPaging = true; adsource.CurrentPageIndex = pos; BtnFirst.Enabled = !adsource.IsFirstPage; BtnPrevious.Enabled = !adsource.IsFirstPage; BtnLast.Enabled = !adsource.IsLastPage; BtnNext.Enabled = !adsource.IsLastPage; DlSchools.DataSource = adsource; DlSchools.DataBind(); }