protected void lv_OnPagePropertiesChanging(object sender, PagePropertiesChangingEventArgs e) { DataPager dp = (lv_ThongBao.FindControl("dp") as DataPager); dp.SetPageProperties(e.StartRowIndex, e.MaximumRows, false); BindListView(); }
//Make sure paging of header and data is syncronized by setting page properties of row-pager to the same as header pager protected void pgColData_OnLoad(object sender, EventArgs e) { DataPager pgColHeaders = (DataPager)this.lvPollutantReleases.FindControl("pgColHeaders"); DataPager pgData = (DataPager)sender; pgData.SetPageProperties(pgColHeaders.StartRowIndex, pgColHeaders.MaximumRows, false); }
public void FormViewCreate_InsertItem() { var item = new Category(); TryUpdateModel(item); if (ModelState.IsValid) { _context.Categories.Add(item); _context.SaveChanges(); } FormView FormViewCreate = UpdatePanelCreate.FindControl("FormViewCreate") as FormView; FormViewCreate.Visible = false; ListView ListViewCategories = UpdatePanelCategories.FindControl("ListViewCategories") as ListView; DataPager DataPagerCategories = ListViewCategories.FindControl("DataPagerCategories") as DataPager; int lastpage = (DataPagerCategories.TotalRowCount + 1) / DataPagerCategories.PageSize; if (((DataPagerCategories.TotalRowCount + 1) % DataPagerCategories.PageSize) == 0) { lastpage--; } DataPagerCategories.SetPageProperties(lastpage * DataPagerCategories.PageSize, DataPagerCategories.MaximumRows, true); }
// The id parameter name should match the DataKeyNames value set on the control public void ListViewCategories_DeleteItem(int Id) { Category item = null; item = _context.Categories.Find(Id); if (item == null) { // The item wasn't found ModelState.AddModelError("", String.Format("Item with id {0} was not found", Id)); return; } _context.Categories.Remove(item); _context.SaveChanges(); ListView ListViewCategories = UpdatePanelCategories.FindControl("ListViewCategories") as ListView; DataPager DataPagerCategories = ListViewCategories.FindControl("DataPagerCategories") as DataPager; int lastpage = (DataPagerCategories.TotalRowCount - 1) / DataPagerCategories.PageSize; if (((DataPagerCategories.TotalRowCount - 1) % DataPagerCategories.PageSize) == 0) { lastpage--; } DataPagerCategories.SetPageProperties((lastpage) * DataPagerCategories.PageSize, DataPagerCategories.MaximumRows, true); }
//This method switches views on the MultiView protected void RouteMenu_MenuItemClick(object sender, MenuEventArgs e) { int index = Int32.Parse(e.Item.Value); //RoutesMultiView.ActiveViewIndex = index; RouteController routeManager = new RouteController(); //Gets hold of the Pager to reset it when user changes route type DataPager pager = (DataPager)RouteListView.FindControl("Route_DataPager"); switch (index) { case 0: SiteType.Text = "1"; RouteType.Text = "A"; pager.SetPageProperties(0, pager.PageSize, true); break; case 1: SiteType.Text = "2"; RouteType.Text = "B"; pager.SetPageProperties(0, pager.PageSize, true); break; case 2: SiteType.Text = "3"; RouteType.Text = "Grass"; pager.SetPageProperties(0, pager.PageSize, true); break; case 3: SiteType.Text = "4"; break; case 4: SiteType.Text = "5"; RouteType.Text = "Planting"; pager.SetPageProperties(0, pager.PageSize, true); break; } }
protected void lvData_OnPagePropertiesChanging(object sender, PagePropertiesChangingEventArgs e) { if (BasePager != null) { BasePager.SetPageProperties(e.StartRowIndex, e.MaximumRows, false); BindDataToListView(); } }
protected void Lvw_transactions_PagePropertiesChanging(object sender, PagePropertiesChangingEventArgs e) { DataPager dp = (DataPager)Lvw_transactions.FindControl("DataPager1"); dp.SetPageProperties(e.StartRowIndex, e.MaximumRows, false); Lvw_transactions.DataSource = DBOps.UserTransactionsTable(((string)(Session["currUser"]))); Lvw_transactions.DataBind(); }
protected void lvw_items_PagePropertiesChanging(object sender, PagePropertiesChangingEventArgs e) { DataPager dp = (DataPager)lvw_items.FindControl("DataPager1"); dp.SetPageProperties(e.StartRowIndex, e.MaximumRows, false); lvw_items.DataSource = DBOps.BuildUserCart(_refKey); lvw_items.DataBind(); }
protected void lstviewCannedRecords_PagePropertiesChanging(object sender, PagePropertiesChangingEventArgs e) { int startrowindex = e.StartRowIndex; DataPager.SetPageProperties(startrowindex, e.MaximumRows, false); lstviewCannedRecords.EditIndex = -1; this.Bind(); }
public override void HandleEvent(CommandEventArgs e) { if (e.CommandName == "UpdatePageSize") { int pgsz = int.Parse(e.CommandArgument.ToString()); Util.SetPageSizeCookie(pgsz); DataPager.PageSize = pgsz; DataPager.SetPageProperties(startRowIndex, pgsz, true); return; } if (e.CommandName == "GoToItem") { int newStartRowIndex; if (int.TryParse(e.CommandArgument.ToString(), out newStartRowIndex)) { DataPager.SetPageProperties(newStartRowIndex - 1, DataPager.PageSize, true); } return; } if (!DataPager.QueryStringField.HasValue()) { if (e.CommandName == "Prev") { if (GoNextPrev != null) { GoNextPrev(this, e); } int startrow = startRowIndex - DataPager.PageSize; if (startrow < 0) { startrow = 0; } DataPager.SetPageProperties(startrow, DataPager.PageSize, true); } else if (e.CommandName == "Next") { if (GoNextPrev != null) { GoNextPrev(this, e); } int nextstart = startRowIndex + DataPager.PageSize; if (nextstart > totalRowCount) { nextstart = totalRowCount - DataPager.PageSize; } if (nextstart < 0) { nextstart = 0; } DataPager.SetPageProperties(nextstart, DataPager.PageSize, true); } } }
protected void ddlSets_SelectedIndexChanged(object sender, EventArgs e) { DataPager pgr = lvImages.FindControl("DataPager1") as DataPager; if (pgr != null && lvImages.Items.Count != pgr.TotalRowCount) { pgr.SetPageProperties(0, pgr.MaximumRows, false); } }
protected void CurrentPageChanged(object sender, EventArgs e) { TextBox txtCurrentPage = sender as TextBox; DataPager pager = this.lvMAWB.FindControl("pager") as DataPager; int startRowIndex = (int.Parse(txtCurrentPage.Text) - 1) * pager.MaximumRows; pager.SetPageProperties(startRowIndex, pager.MaximumRows, true); }
protected void ProductListView_PagePropertiesChanging(object sender, PagePropertiesChangingEventArgs e) { DataPager pager = ProductListView.FindControl("pager") as DataPager; pager.SetPageProperties(e.StartRowIndex, e.MaximumRows, false); string productId = ProductDetailsView.DataKey[0].ToString(); LoadComments(productId); LoadProduct(productId); }
protected void ResetDataPager(string siteTypeID) { SiteTypeID.Text = siteTypeID; DataPager topPager = (DataPager)RouteListView.FindControl("TopDataPager"); DataPager bottomPager = (DataPager)RouteListView.FindControl("BottomDataPager"); topPager.SetPageProperties(0, topPager.PageSize, true); bottomPager.SetPageProperties(0, bottomPager.PageSize, true); RouteListView.Visible = true; }
private void ResetPageNumber(bool dataBind) { DataPager currentPager = this.CurrentPager; if (currentPager == null) { return; } currentPager.SetPageProperties(0, this.MainListView.CurrentPageSize, dataBind); }
/// <summary> /// This will control the paging of information /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void StackOverFlowQuestionsListView_PagePropertiesChanging(object sender, PagePropertiesChangingEventArgs e) { DataPager dp = (DataPager)FindControl("DataPager1"); dp.SetPageProperties(e.StartRowIndex, e.MaximumRows, false); LoadQuestions(); lblSelectedQuestions.Text = ""; lblSelectedQuestionsLabel.Visible = false; StackOverFlowAnswersListView.Visible = false; }
protected void ExportListViewToWord1_PagePropertiesChanging(object sender, PagePropertiesChangingEventArgs e) { DataPager objDataPager1 = (DataPager)ExportListViewToWord1.FindControl("DataPager1"); if (objDataPager1 != null) { objDataPager1.SetPageProperties(e.StartRowIndex, e.MaximumRows, false); BindListView(); } }
protected void lvMenuItems_PagePropertiesChanging(object sender, PagePropertiesChangingEventArgs e) { using (DowntownDeliEntity dde = new DowntownDeliEntity()) { DataPager lvMenuItemsPager = lvMenuItems.FindControl("lvMenuItemsPager") as DataPager; int CurrentPage = ((lvMenuItemsPager.StartRowIndex) / lvMenuItemsPager.MaximumRows) + 1; lvMenuItemsPager.SetPageProperties(lvMenuItemsPager.StartRowIndex, lvMenuItemsPager.MaximumRows, false); lvMenuItems.DataSource = dde.Products.OrderBy(t => t.Product_Name).ToList(); lvMenuItems.DataBind(); } }
protected void lvw_items_PagePropertiesChanging(object sender, PagePropertiesChangingEventArgs e) { // Prevent the pager from showing an empty page // in case the user deletes all the items in a // single page DataPager dp = (DataPager)lvw_items.FindControl("DataPager1"); dp.SetPageProperties(e.StartRowIndex, e.MaximumRows, false); lvw_items.DataSource = DBOps.BuildUserCart(_userCartId); lvw_items.DataBind(); }
protected void lvCurrentOrders_PagePropertiesChanging(object sender, PagePropertiesChangingEventArgs e) { using (DowntownDeliEntity dde = new DowntownDeliEntity()) { ListView lvCurrentOrders = (ListView)HeadLoginView.FindControl("lvCurrentOrders"); DataPager lvCurrentOrdersPager = lvCurrentOrders.FindControl("lvCurrentOrdersPager") as DataPager; int CurrentPage = ((lvCurrentOrdersPager.StartRowIndex) / lvCurrentOrdersPager.MaximumRows) + 1; lvCurrentOrdersPager.SetPageProperties(lvCurrentOrdersPager.StartRowIndex, lvCurrentOrdersPager.MaximumRows, false); lvCurrentOrders.DataSource = dde.Orders.Include("Customer").Where(t => t.Complete == false || t.Complete == null).ToList(); lvCurrentOrders.DataBind(); } }
protected void lvVeiculos_PagePropertiesChanging(object sender, PagePropertiesChangingEventArgs e) { try { DataPager dp = (DataPager)lvVeiculos.FindControl("lvVeiculosDataPage"); dp.SetPageProperties(e.StartRowIndex, e.MaximumRows, false); CarregarVeiculos(); } catch (Exception ex) { } }
protected void AplicarMiniFiltro(object sender, EventArgs e) { // nótese lo que se debe hacer para poner el ListView en su 1ra. página ... DataPager pgr = this.ComprobantesContables_ListView.FindControl("ComprobantesContables_DataPager") as DataPager; if (pgr != null) { pgr.SetPageProperties(0, pgr.MaximumRows, false); } this.ComprobantesContables_ListView.DataBind(); ComprobantesContables_ListView.SelectedIndex = -1; }
protected void Page_PreRenderComplete(object sender, EventArgs e) { //PreRenderComplete occurs just after databinding page events //load a pointer to point to your DataPager control DataPager thePager = TracksSelectionList.FindControl("DataPager1") as DataPager; if (thePager != null) { //this code will check the StartRowIndex to see if it is greater than the //total count of the collection if (thePager.StartRowIndex > thePager.TotalRowCount) { thePager.SetPageProperties(0, thePager.MaximumRows, true); } } }
protected void btnFind_Click(object sender, EventArgs e) { CustomValidator1.IsValid = true; RequiredFieldValidator1.IsValid = true; //Page.Validate(); if (Page.IsValid) { Session["CANNED_SearchParam"] = txtFind.Text.Trim(); lstviewCannedRecords.EditIndex = -1; this.Bind(); //DataPagerTop.SetPageProperties(0, NumValue, true); DataPager.SetPageProperties(0, DataPager.PageSize, true); } }
protected void lvw_items_ItemCommand(object sender, ListViewCommandEventArgs e) { string[] productDetails = ((String)e.CommandArgument).Split(','); try { _cart.RemoveItem(productDetails[0].Trim(), Convert.ToDecimal(productDetails[1].Trim()), Convert.ToInt32(productDetails[2].Trim())); cartDatasource.Update(); _itemSKU = productDetails[0].Trim(); _itemQuant = DBOps.GetProductQuantity(_itemSKU) + Convert.ToInt32(productDetails[2].Trim()); ProductsDataSource.Update(); } catch (Exception) { // ignored } Button button = (Button)UpdatePanel1.FindControl("btn_checkout"); if (DBOps.BuildUserCart(_userCartId).Rows.Count < 1) { if (_user != "-") { //cartDatasource.Delete(); //DataOps.reassignUserCart(user); } button.Enabled = false; button.CssClass = "btn btn-outline-secondary btn-block"; } DataPager dp = (DataPager)lvw_items.FindControl("DataPager1"); if (lvw_items.Items.Count <= 1) { dp.SetPageProperties(0, dp.MaximumRows, false); } lvw_items.DataSource = DBOps.BuildUserCart(_userCartId); lvw_totals.DataSource = DBOps.BuildUserCartTotals(_userCartId); lvw_items.DataBind(); lvw_totals.DataBind(); SiteMaster master = Page.Master as SiteMaster; master.UpdateTotalCounters(); }
private void populateList(bool refresh) { DataPager pgColHeaders = (DataPager)this.lvPollutantReleases.FindControl("pgColHeaders"); if (refresh && pgColHeaders != null) { pgColHeaders.SetPageProperties(0, pgColHeaders.MaximumRows, false); } this.lvPollutantReleases.DataSource = ViewState[COLDATA]; this.lvPollutantReleases.DataBind(); // notify that content has changed (print) if (ContentChanged != null) { ContentChanged.Invoke(null, EventArgs.Empty); } }
public override void HandleEvent(CommandEventArgs e) { if (String.IsNullOrEmpty(DataPager.QueryStringField)) { int newStartRowIndex = -1; int currentPageIndex = _startRowIndex / DataPager.PageSize; int firstButtonIndex = (_startRowIndex / (ButtonCount * DataPager.PageSize)) * ButtonCount; int lastButtonIndex = firstButtonIndex + ButtonCount - 1; int lastRecordIndex = ((lastButtonIndex + 1) * DataPager.PageSize) - 1; if (String.Equals(e.CommandName, DataControlCommands.PreviousPageCommandArgument)) { newStartRowIndex = (firstButtonIndex - 1) * DataPager.PageSize; if (newStartRowIndex < 0) { newStartRowIndex = 0; } } else if (String.Equals(e.CommandName, DataControlCommands.NextPageCommandArgument)) { newStartRowIndex = lastRecordIndex + 1; if (newStartRowIndex > _totalRowCount) { newStartRowIndex = _totalRowCount - DataPager.PageSize; } } else if (string.Equals(e.CommandName, "UpdatePageSize")) { DataPager.PageSize = Int32.Parse(e.CommandArgument.ToString()); DataPager.SetPageProperties(_startRowIndex, DataPager.PageSize, true); } else { int pageIndex = Convert.ToInt32(e.CommandName, CultureInfo.InvariantCulture); newStartRowIndex = pageIndex * DataPager.PageSize; } if (newStartRowIndex != -1) { DataPager.SetPageProperties(newStartRowIndex, DataPager.PageSize, true); } } }
private void CreateDataPagersForQueryString(DataPagerFieldItem container, int fieldIndex) { bool validPageIndex = false; if (!QueryStringHandled) { int num; QueryStringHandled = true; if (int.TryParse(base.QueryStringValue, out num)) { num--; int currentPageIndex = startRowIndex / maximumRows; int maxPageIndex = (totalRowCount - 1) / maximumRows; if ((num >= 0) && (num <= maxPageIndex)) { startRowIndex = num * maximumRows; validPageIndex = true; } } } CreateGoToTexBox(container); CreatePageSizeControl(container); CreateLabelRecordControl(container); int pageIndex = (startRowIndex / maximumRows) - 1; container.Controls.Add(CreateLink(PreviousPageText, pageIndex, PreviousPageImageUrl, EnablePreviousPage)); AddNonBreakingSpace(container); int pagenum = (startRowIndex + maximumRows) / maximumRows; container.Controls.Add(CreateLink(NextPageText, pagenum, NextPageImageUrl, EnableNextPage)); AddNonBreakingSpace(container); if (validPageIndex) { DataPager.SetPageProperties(startRowIndex, maximumRows, true); } }
/// <summary> /// The handle event. /// </summary> /// <param name="e"> /// The e. /// </param> public override void HandleEvent(CommandEventArgs e) { int page; if (Int32.TryParse(e.CommandName, out page)) { DataPager dataPager = base.DataPager; int pageSize = PageSize; int nextStartRowIndex = pageSize * page; if (nextStartRowIndex > dataPager.TotalRowCount) { nextStartRowIndex = dataPager.TotalRowCount - pageSize; } if (nextStartRowIndex < 0) { nextStartRowIndex = 0; } dataPager.SetPageProperties(nextStartRowIndex, pageSize, true); } }
/// <summary> /// Creates the user interface (UI) controls for the pager field object and adds them to the specified container. /// </summary> /// <param name="container">The container that is used to store the controls.</param> /// <param name="startRowIndex">The index of the first record on the page.</param> /// <param name="maximumRows">The maximum number of items on a single page.</param> /// <param name="totalRowCount">The total number of items.</param> /// <param name="fieldIndex">The index of the data pager field in the <see cref="P:System.Web.UI.WebControls.DataPager.Fields"/> collection.</param> public override void CreateDataPagers(DataPagerFieldItem container, int startRowIndex, int maximumRows, int totalRowCount, int fieldIndex) { int currentPageIndex = startRowIndex / DataPager.PageSize; object currentPageObj = DataPager.Page.Request.QueryString[this.DataPager.QueryStringField]; short currentQSPageIndex; bool resetProperties = false; if (currentPageObj != null) { bool parsed = Int16.TryParse(currentPageObj.ToString(), out currentQSPageIndex); if (parsed) { currentQSPageIndex--; int highestPageIndex = (totalRowCount - 1) / maximumRows; if (currentPageIndex != currentQSPageIndex && currentQSPageIndex <= highestPageIndex) { currentPageIndex = currentQSPageIndex; startRowIndex = (currentPageIndex * DataPager.PageSize); resetProperties = true; } } } int firstButtonIndex = (startRowIndex / (ButtonCount * DataPager.PageSize)) * ButtonCount; int lastButtonIndex = firstButtonIndex + ButtonCount - 1; int lastRecordIndex = ((lastButtonIndex + 1) * DataPager.PageSize) - 1; if (firstButtonIndex != 0) { container.Controls.Add(CreateNextPrevButton(PreviousPageText, firstButtonIndex - 1, PreviousPageImageUrl)); if (RenderNonBreakingSpacesBetweenControls) { container.Controls.Add(new LiteralControl(" ")); } } for (int i = 0; i < ButtonCount && totalRowCount > ((i + firstButtonIndex) * DataPager.PageSize); i++) { if (i + firstButtonIndex == currentPageIndex) { Label pageNumber = new Label(); pageNumber.Text = (i + firstButtonIndex + 1).ToString(CultureInfo.InvariantCulture); if (!String.IsNullOrEmpty(CurrentPageLabelCssClass)) { pageNumber.CssClass = CurrentPageLabelCssClass; } container.Controls.Add(pageNumber); } else { container.Controls.Add(CreateNumericButton(i + firstButtonIndex)); } if (RenderNonBreakingSpacesBetweenControls) { container.Controls.Add(new LiteralControl(" ")); } } if (lastRecordIndex < totalRowCount - 1) { if (RenderNonBreakingSpacesBetweenControls) { container.Controls.Add(new LiteralControl(" ")); } container.Controls.Add(CreateNextPrevButton(NextPageText, firstButtonIndex + ButtonCount, NextPageImageUrl)); if (RenderNonBreakingSpacesBetweenControls) { container.Controls.Add(new LiteralControl(" ")); } } if (resetProperties) { DataPager.SetPageProperties(startRowIndex, maximumRows, true); } }