Current filter:
                                You should refresh the page.
                                Support Center
                                0
                                  • We're using a grid including the CommandColumn. How would we pre-select a row (from a model) when the view with the grid is revisited?

                                    Many Thanks!

                                You must  log in  or  register  to leave comments

                                1 Solution

                                0

                                Hello Irfaan,

                                Thank you for contacting us. I suggest that you implement the following scenario to accomplish this task:
                                1) Use the GridViewSettings.PreRender property, to get access to the internal ASPxGridView object and its Selection state;
                                2) Iterate through the DataRows (from "0" to VisibleRowCount) and select the required DataRow based on the Model data via the Selection.SetSelection method.

                                Below the code snippet, illustrating how to accomplish this task by using the Grid View - Filter Row Online Demo:

                                ~/Views/GridView/FilterRowPartial.ascx:

                                	
                                [C#]
                                //... settings.KeyFieldName = "ProductID"; //... settings.PreRender = (sender, e) => { ASPxGridView gridView = (ASPxGridView)sender; for (int i = 0; i < gridView.VisibleRowCount; i++) { gridView.Selection.SetSelection(i, (bool)gridView.GetRowValues(i, "Discontinued")); } };

                                See Also:
                                E20039 - GridView - How to Select a Particular Rows when a Page is Opened First Time

                                Regards,
                                Mike

                                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