protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string zk = "select * from gallery where IsShow=1"; DataSet ds = new DataSet(); ds = dc.getdata(zk); GalleryRptr.DataSource = ds; GalleryRptr.DataBind(); DataSet ds3 = new DataSet(); string zkp = "select * from admissioncategory where IsShow=1"; ds3 = dc.getdata(zkp); AdmissionCategoryRptr.DataSource = ds3; AdmissionCategoryRptr.DataBind(); DataSet ds1 = new DataSet(); string jk = "select * from joboffercategory where IsShow=1"; ds1 = dc.getdata(jk); JobOfferCategoryRptr.DataSource = ds1; JobOfferCategoryRptr.DataBind(); } }
private void GetGalleryData() { string jk = "select * from gallery ORDER BY CreatedOn DESC"; DataSet ds = new DataSet(); ds = dc.getdata(jk); DataTable dt = ds.Tables[0]; PagedDataSource pgitems = new PagedDataSource(); pgitems.DataSource = dt.DefaultView; pgitems.AllowPaging = true; //Control page size from here pgitems.PageSize = 4; pgitems.CurrentPageIndex = PageNumber; if (pgitems.PageCount > 1) { rptPaging.Visible = true; ArrayList pages = new ArrayList(); for (int i = 0; i <= pgitems.PageCount - 1; i++) { pages.Add((i + 1).ToString()); } rptPaging.DataSource = pages; rptPaging.DataBind(); } else { rptPaging.Visible = false; } //Finally, set the datasource of the repeater GalleryRptr.DataSource = pgitems; GalleryRptr.DataBind(); //GalleryRptr.DataSource = ds; //GalleryRptr.DataBind(); }