Current filter:
                                You should refresh the page.
                                Support Center
                                0
                                  • HI,


                                    trying to use the aspxgridview.pageindex changed event to update the page index of other grids on the page


                                    I have the following code:



                                    	
                                    [C#]
                                    protected void ASPxGridViewLineValues_PageIndexChanged(object sender, EventArgs e) { int pageIndex = (sender as ASPxGridView).PageIndex; ASPxGridViewLineAuthorisation.PageIndex = pageIndex; this.BindAuthorisationGrid(); ASPxGridViewLineBudget.PageIndex = pageIndex; this.BindBudgetsGrid(); ASPxGridViewLineProject.PageIndex = pageIndex; this.BindProjectsGrid(); ASPxGridViewLineQuantities.PageIndex =pageIndex; this.BindQuantitiesGrid(); }

                                    

                                    The page index of the sender gridview is always 0. how can I get the page index?


                                    The markup for my grid is as follows:


                                    	
                                    [ASPx]
                                    <dx:ASPxGridView ID="ASPxGridViewLineValues" runat="server" AutoGenerateColumns="False" Width="100%" OnAfterPerformCallback="ASPxGridViewLineValues_AfterPerformCallback" OnRowCommand="ASPxGridView_RowCommand" KeyFieldName="OrderLineID" OnInit="ASPxGridViewLineValues_Init" OnHtmlDataCellPrepared="ASPxGridViewLineValues_HtmlDataCellPrepared" OnHtmlRowPrepared="ASPxGridView_HtmlRowPrepared" OnPageIndexChanged="ASPxGridViewLineValues_PageIndexChanged"> <Columns> <dx:GridViewDataTextColumn Caption="Item" FieldName="ItemCode" Name="ItemCode" VisibleIndex="1"> <HeaderStyle HorizontalAlign="Left" /> <CellStyle HorizontalAlign="Left"> </CellStyle> </dx:GridViewDataTextColumn> <dx:GridViewDataTextColumn Caption="Description" FieldName="Description" Name="Description" VisibleIndex="2"> <HeaderStyle HorizontalAlign="Left" /> <CellStyle HorizontalAlign="Left"> </CellStyle> </dx:GridViewDataTextColumn> <dx:GridViewDataTextColumn Caption="Quantity" FieldName="Quantity" Name="Quantity" VisibleIndex="3"> <PropertiesTextEdit DisplayFormatString="{0:0.00}"> </PropertiesTextEdit> <HeaderStyle HorizontalAlign="Right" /> <CellStyle HorizontalAlign="Right"> </CellStyle> </dx:GridViewDataTextColumn> <dx:GridViewDataTextColumn Caption="Unit Price" FieldName="UnitPrice" Name="UnitPrice" VisibleIndex="4"> <PropertiesTextEdit DisplayFormatString="{0:0.00}"> </PropertiesTextEdit> <HeaderStyle HorizontalAlign="Right" /> <CellStyle HorizontalAlign="Right"> </CellStyle> </dx:GridViewDataTextColumn> <dx:GridViewDataTextColumn Caption="Discount %" FieldName="DiscountPercent" Name="DiscountPercent" VisibleIndex="5"> <PropertiesTextEdit DisplayFormatString="{0:0.00}"> </PropertiesTextEdit> <HeaderStyle HorizontalAlign="Right" /> <CellStyle HorizontalAlign="Right"> </CellStyle> </dx:GridViewDataTextColumn> <dx:GridViewDataTextColumn Caption="Tax Rate" FieldName="SYSTaxRateName" Name="TaxRate" VisibleIndex="6"> <HeaderStyle HorizontalAlign="Left" /> <CellStyle HorizontalAlign="Left"> </CellStyle> </dx:GridViewDataTextColumn> <dx:GridViewDataTextColumn Caption="Net" FieldName="TotalPrice" Name="Net" VisibleIndex="7"> <PropertiesTextEdit DisplayFormatString="{0:0.00}"> </PropertiesTextEdit> <HeaderStyle HorizontalAlign="Right" /> <CellStyle HorizontalAlign="Right"> </CellStyle> </dx:GridViewDataTextColumn> <dx:GridViewDataColumn VisibleIndex="8"> <DataItemTemplate> <table> <tr> <td> <dx:ASPxButton ID="btnEdit" runat="server" CommandName="Edit" Text="Edit" ToolTip="Edit this item" CommandArgument='<%# DataBinder.Eval(Container,"ItemIndex") %>' /> </td> <td> <dx:ASPxButton ID="btnDelete" runat="server" CommandName="Delete" Text="Delete" CommandArgument='<%# DataBinder.Eval(Container,"ItemIndex") %>' ToolTip="Delete this item"> <ClientSideEvents Click="function(s, e) { e.processOnServer = confirm('Are you sure you want to delete this item?'); }" /> </dx:ASPxButton> </td> </tr> </table> </DataItemTemplate> </dx:GridViewDataColumn> <dx:GridViewDataTextColumn Caption="Ref" FieldName="LineNumber" Name="Ref" VisibleIndex="0"> <PropertiesTextEdit DisplayFormatString="{0:0}"> </PropertiesTextEdit> <HeaderStyle HorizontalAlign="Left" /> <CellStyle HorizontalAlign="Left"> </CellStyle> </dx:GridViewDataTextColumn> </Columns> </dx:ASPxGridView>

                                    

                                • Hello Nathan;

                                  I do not see any potentially problematic line that can cause this behavior. Would you please demonstrate how you customize and use the main ASPxGridView in your project?

                                  Also, please note that if the main grid operates in the Callback mode, other grids changes will not be reflected on the client-side when the main grid is paged. Please refer to the following resources for details:
                                  The concept of callbacks - Why is it impossible to update external control data during a callback to another control
                                  The Concept of Callbacks

                                • Nathan Freeman-Smith 10.12.2012

                                  I thanks for the information regarding changing the page index of other grids, that will be useful for later. I have added the markup for my grid to the question.

                                  Best regards

                                • Nathan Freeman-Smith 10.12.2012

                                  Ill still need to use the server side page index changed, but could you also show me how to achieve keeping all aspxgrids in sync whenthe page index changes clientside?

                                You must  log in  or  register  to leave comments

                                1 Solution

                                0

                                Hi Nathan,

                                You can use one of the following solutions to synchronize the PageIndex of all the grids based on the PageIndex of the "ASPxGridViewLineValues" grid:

                                1- Set the ASPxGridView.EnableCallBacks to “false” for the "ASPxGridViewLineValues" grid. Change the PageIndex of the other grids in the ASPxGridView.PageIndexChanged event of the "ASPxGridViewLineValues" grid.

                                In this case a full PostBack is sent to the server when the PageIndex of the "ASPxGridViewLineValues" grid is changed. The PageIndex of all other grids are also updated as a result of this PostBack.

                                2- If there are other controls in the page besides the five grids and you do not want them to get refreshed after each PostBack, wrap the grids inside an UpdatePanel.

                                In this case, all of the grids get refreshed whenever the PageIndex of the "ASPxGridViewLineValues" grid is changed.

                                3- Handle the ASPxClientGridView.EndCallback event of the "ASPxGridViewLineValues" grid to send a call back to the other grids (for example, ASPxGridViewLineAuthorisation.PerformCallback). Change the PageIndex of each grid in its ASPxGridView.CustomCallback event.

                                Our team is dedicated to addressing all your concerns. For quick and efficient responses, we kindly request that future messages cover one issue at a time. Your time and cooperation are appreciated.

                                In order to better serve and track multiple questions in your inquiry, we have taken the liberty of separating the issues you addressed. Please refer to this ticket for further correspondence on this item.

                                1) ASPxGridView -PageIndex is always 0 in PageIndexChanged event

                                • Nathan Freeman-Smith 10.15.2012

                                  Hi Kate,

                                  Thanks, if I disable callback on the grids will sorting and grouping still work?

                                  Nathan

                                • Hi,
                                  ASPxGridView.EnableCallBacks property specifies whether the callback or postback (the whole page is refreshed) technology is used to manage round trips to the server. It does not enable or disable grouping, sorting, and other similar functionalities.

                                  In your scenario, you only need to disable callbacks for the first grid ("ASPxGridViewLineValue").

                                • Nathan Freeman-Smith 10.16.2012

                                  Thanks, Ill give it a try.

                                  N

                                • Anthony (DevExpress Support) 10.16.2012

                                  Hello,

                                  You are welcome! We are glad to hear that our assistance was helpful.
                                  Once your question has been resolved to your satisfaction, mark a corresponding Answer as a Solution. Your question status will immediately become Closed.
                                  SC2 FAQ

                                You must  log in  or  register  to leave comments

                                To start a chat you should create a support ticket


                                If you need additional product information, write to us at info@devexpress.com or call us at +1 (818) 844-3383

                                FOLLOW US

                                DevExpress engineers feature-complete Presentation Controls, IDE Productivity Tools, Business Application Frameworks, and Reporting Systems for Visual Studio, along with high-performance HTML JS Mobile Frameworks for developers targeting iOS, Android and Windows Phone. Whether using WPF, Silverlight, ASP.NET, WinForms, HTML5 or Windows 8, DevExpress tools help you build and deliver your best in the shortest time possible.

                                Copyright © 1998-2014 Developer Express Inc.
                                All trademarks or registered trademarks are property of their respective owners