protected void BingProduct() { Product p = new Product(); DataListProduct.DataSource = p.GetProductAndCategory(); DataListProduct.DataKeyField = "ProductId"; DataListProduct.DataBind(); }
protected void items() { PagedDataSource objDs = new PagedDataSource(); DataView dv = (DataView)SqlDataSourceProduct.Select(DataSourceSelectArguments.Empty); objDs.DataSource = dv; objDs.AllowPaging = true; objDs.PageSize = 5; objDs.CurrentPageIndex = CurrentPage; lblCurrentPage.Text = "Page : " + (CurrentPage + 1).ToString() + "of" + objDs.PageCount.ToString(); ButtonPrev.Enabled = !objDs.IsFirstPage; ButtonNext.Enabled = !objDs.IsLastPage; DataListProduct.DataSourceID = null; //Disabled because error happens when loading pages DataListProduct.DataSource = objDs; DataListProduct.DataBind(); }