Hello,
I have a problem with the paging of the RadGrid that I have not been able to resolve . I define the grid in the page_load when the page is loaded for the first time as you can see in the next code:
| private void DefineGridStructureGruposDisp() |
| { |
| RDG_GruposDisp.PagerStyle.ShowPagerText = true; |
| RDG_GruposDisp.AllowPaging = true; |
| RDG_GruposDisp.AllowCustomPaging = false; |
| //RDG_GruposDisp.VirtualItemCount = 100; |
| RDG_GruposDisp.AutoGenerateColumns = false; |
| RDG_GruposDisp.GridLines = GridLines.None; |
| RDG_GruposDisp.ClientSettings.Selecting.AllowRowSelect = false; |
| //Set options to enable Group-by |
| //RDG_GruposDisp.GroupingEnabled = true; |
| RDG_GruposDisp.ShowGroupPanel = false; |
| RDG_GruposDisp.ClientSettings.AllowDragToGroup = false; |
| RDG_GruposDisp.ClientSettings.AllowColumnsReorder = true; |
| //RDG_GruposDisp.MasterTableView.HierarchyLoadMode = GridChildLoadMode.ServerOnDemand; |
| RDG_GruposDisp.MasterTableView.NoDetailRecordsText = "No hay Grupos "; |
| RDG_GruposDisp.MasterTableView.NoMasterRecordsText = "No hay Grupos "; |
| RDG_GruposDisp.MasterTableView.EditMode = GridEditMode.EditForms; |
| RDG_GruposDisp.MasterTableView.AllowSorting = true; |
| RDG_GruposDisp.AllowMultiRowSelection = true; |
| //RDG_GruposDisp.ShowFooter = true; |
| RDG_GruposDisp.Width = Unit.Percentage(100); |
| // Configurar paginación |
| RDG_GruposDisp.MasterTableView.PageSize = 40; |
| RDG_GruposDisp.PagerStyle.Mode = GridPagerMode.NextPrevAndNumeric; |
| //Add columns |
| GridBoundColumn boundColumn = new GridBoundColumn(); |
| RDG_GruposDisp.MasterTableView.Columns.Add(boundColumn); |
| boundColumn.DataField = "idGrupos"; |
| boundColumn.HeaderText = "idGrupos"; |
| boundColumn.UniqueName = "idGrupos"; |
| //boundColumn.DataFormatString = "{0:##,##}"; |
| //boundColumn.Resizable = false; |
| boundColumn.ReadOnly = true; |
| boundColumn.ItemStyle.VerticalAlign = VerticalAlign.Middle; |
| boundColumn.ItemStyle.HorizontalAlign = HorizontalAlign.Center; |
| //boundColumn.FooterText = "Id Evento"; |
| boundColumn.Visible = false; |
| boundColumn = new GridBoundColumn(); |
| RDG_GruposDisp.MasterTableView.Columns.Add(boundColumn); |
| boundColumn.DataField = "Grupos"; |
| boundColumn.HeaderText = "Grupos"; |
| boundColumn.UniqueName = "Grupos"; |
| //boundColumn.DataFormatString = "{0:##,##}"; |
| //boundColumn.Resizable = false; |
| boundColumn.ReadOnly = true; |
| boundColumn.ItemStyle.VerticalAlign = VerticalAlign.Middle; |
| boundColumn.ItemStyle.HorizontalAlign = HorizontalAlign.Center; |
| //boundColumn.FooterText = "Grupo"; |
| boundColumn.Visible = true; |
| } |
I use needdatasource to pass data where i call the funtion through Rebind():
| protected void RDG_GruposDisp_NeedDataSource(object source, GridNeedDataSourceEventArgs e) |
| { |
| String Rebind = e.RebindReason.ToString(); |
| if (Rebind == "ExplicitRebind" || Rebind == "DetailTableBinding, PostBackEvent") |
| { |
| RDG_GruposDisp.DataSource = eventos.GetGruposD_P(DDLProvincias.SelectedValue) ; |
| } |
| } |
The problem is that i can´t reset the paging of the grid, I mean if I first do a query where I select a value in the combobox that retrieves 1000 data after that I change that value in the combobox now selecting 500 data and the paging is still retrieving me 1000 data, the same number of pages when indeed it should just have 500 a half of pages . However in the grid are the data correctly but the client can be confused by thinking that there are more data that shows the paging.
I hope that you understand what I wrote, sorry for my poor English.
Julio
| private void DefineGridStructureGruposDisp() |
| { |
| RDG_GruposDisp.PagerStyle.ShowPagerText = true; |
| RDG_GruposDisp.AllowPaging = true; |
| RDG_GruposDisp.AllowCustomPaging = false; |
| //RDG_GruposDisp.VirtualItemCount = 100; |
| RDG_GruposDisp.AutoGenerateColumns = false; |
| RDG_GruposDisp.GridLines = GridLines.None; |
| RDG_GruposDisp.ClientSettings.Selecting.AllowRowSelect = false; |
| //Set options to enable Group-by |
| //RDG_GruposDisp.GroupingEnabled = true; |
| RDG_GruposDisp.ShowGroupPanel = false; |
| RDG_GruposDisp.ClientSettings.AllowDragToGroup = false; |
| RDG_GruposDisp.ClientSettings.AllowColumnsReorder = true; |
| //RDG_GruposDisp.MasterTableView.HierarchyLoadMode = GridChildLoadMode.ServerOnDemand; |
| RDG_GruposDisp.MasterTableView.NoDetailRecordsText = "No hay idGrupos "; |
| RDG_GruposDisp.MasterTableView.NoMasterRecordsText = "No hay idGrupos "; |
| RDG_GruposDisp.MasterTableView.EditMode = GridEditMode.EditForms; |
| RDG_GruposDisp.MasterTableView.AllowSorting = true; |
| //RDG_GruposDisp.MasterTableView.DataKeyNames = new string[] { "idEvento" }; |
| RDG_GruposDisp.AllowMultiRowSelection = true; |
| //RDG_GruposDisp.ShowFooter = true; |
| RDG_GruposDisp.Width = Unit.Percentage(100); |
| // Configurar paginación |
| RDG_GruposDisp.MasterTableView.PageSize = 40; |
| RDG_GruposDisp.PagerStyle.Mode = GridPagerMode.NextPrevAndNumeric; |
| //Add columns |
| GridBoundColumn boundColumn = new GridBoundColumn(); |
| RDG_GruposDisp.MasterTableView.Columns.Add(boundColumn); |
| boundColumn.DataField = "idGrupos"; |
| boundColumn.HeaderText = "idGrupos"; |
| boundColumn.UniqueName = "idGrupos"; |
| //boundColumn.DataFormatString = "{0:##,##}"; |
| //boundColumn.Resizable = false; |
| boundColumn.ReadOnly = true; |
| boundColumn.ItemStyle.VerticalAlign = VerticalAlign.Middle; |
| boundColumn.ItemStyle.HorizontalAlign = HorizontalAlign.Center; |
| //boundColumn.FooterText = "Id Evento"; |
| boundColumn.Visible = false; |
| boundColumn = new GridBoundColumn(); |
| RDG_GruposDisp.MasterTableView.Columns.Add(boundColumn); |
| boundColumn.DataField = "Grupos"; |
| boundColumn.HeaderText = "Grupos"; |
| boundColumn.UniqueName = "Grupos"; |
| //boundColumn.DataFormatString = "{0:##,##}"; |
| //boundColumn.Resizable = false; |
| boundColumn.ReadOnly = true; |
| boundColumn.ItemStyle.VerticalAlign = VerticalAlign.Middle; |
| boundColumn.ItemStyle.HorizontalAlign = HorizontalAlign.Center; |
| //boundColumn.FooterText = "Grupo"; |
| boundColumn.Visible = true; |
| } |