Current filter:
                                You should refresh the page.
                                0
                                  • Hello,

                                     We would want to do the following:
                                     When first loading a ASPxGridView connected to a LinqServerModeDataSource if no filter is then filled pagesize = 0
                                     Once a filter is defined for the grid pagesize then goes to 25!
                                     We have implemented this feature in the event of the ASPxGridView OnDataBound:

                                      ASPxGridView grid = sender as ASPxGridView:
                                                
                                                 if (grid.FilterExpression! = "")
                                                     grid.SettingsPager.PageSize = 25;
                                                              else
                                                     grid.SettingsPager.PageSize = 0;

                                     This works, however, when the filter brings back no records and then we make a
                                     ClearFilter () on the ASPxGridView a javascript error message appears: "Attempt to divide by zero"

                                     What happened

                                     Thank you for your swift return

                                0

                                Hi Ankri,

                                I was not able to reproduce this behavior.
                                Attached is the archive with a sample project I used together with a short video demonstrating my steps.

                                Would you please modify my sample or provide yours?

                                Thanks,
                                Alex, ASP.NET Team

                                B208329.zip
                                0

                                hello alex,

                                 We have just find solution:
                                 it seems that when the property pagesize = 0 and the property AllowFocusedRow = "true" the problem appears!

                                aspx :
                                 <dx:LinqServerModeDataSource ID="LinqServerModeDataSource1" runat="server" OnSelecting="lsmds_Selecting"
                                                DefaultSorting="[DateGC] desc" />
                                            <dx:ASPxGridView ID="ASPxGridView1" runat="server" Width="100%" KeyFieldName="idcandidat"
                                                AutoGenerateColumns="false" OnDataBound="ASPxGridView1_DataBound" DataSourceID="LinqServerModeDataSource1">
                                                <Columns>
                                                    <dx:GridViewDataTextColumn ShowInCustomizationForm="true" Visible="true" VisibleIndex="21"
                                                        Name="LibCandidat" FieldName="LibCandidat" Caption="<%$ Resources:LocalizedText, lb_778 %>"
                                                        Width="300px">
                                                        <CellStyle HorizontalAlign="Left" Wrap="True">
                                                        </CellStyle>
                                                    </dx:GridViewDataTextColumn>
                                                </Columns>
                                                <SettingsBehavior EnableRowHotTrack="true" AllowFocusedRow="false" ConfirmDelete="true" />
                                                <SettingsPager PageSize="0">
                                                </SettingsPager>
                                                <Settings ShowFilterBar="Visible" ShowFilterRow="True" />
                                            </dx:ASPxGridView>

                                c#
                                 protected void lsmds_Selecting(object sender, DevExpress.Data.Linq.LinqServerModeDataSourceSelectEventArgs e)
                                        {

                                                      dc_CandidatDataContext gDC = new dc_CandidatDataContext(HttpContext.Current.Session["Db_Source"].ToString());

                                            var query = from v in gDC.V_ListeCandidats_E
                                                        where (v.idPoste == -1) && ((v.EtatPoste == 0) || (v.EtatPoste == null))
                                                        select v;

                                            e.KeyExpression = "idcandidat";
                                            e.QueryableSource = query;

                                        }

                                        protected void ASPxGridView1_DataBound(Object sender, EventArgs e)
                                        {

                                            ASPxGridView grid = sender as ASPxGridView;

                                            if (grid.FilterExpression != "")
                                                grid.SettingsPager.PageSize = 5;
                                            else
                                                grid.SettingsPager.PageSize = 0;
                                        }

                                0

                                Hi Ankri,

                                Thank you for the code.
                                Now I can reproduce the problem.

                                I passed this bug report to our developers for further research.
                                We will notify you as soon as the fix is ready.

                                Thanks,
                                Alex, ASP.NET Team

                                0

                                Ok

                                You must  log in  or  register  to leave an answer

                                Is your intention to post an answer to your own question?

                                • If so, then proceed.
                                • If you simply wanted to post additional information, ask for further clarification, or to just say "Thanks!", please click Leave a Comment.
                                • If you wish to edit your original question, please use the Edit button in the Toolbox at the top right corner of that entry.