Current filter:
                                You should refresh the page.
                                Support Center
                                0
                                  • I have an ASPxGridView (masterGrid), in which some, but not all records contain "child" records. For the child records, I'm using DetailRows, and inside the template, showing another grid (childGrid). I'm using the method described in http://documentation.devexpress.com/#AspNet/CustomDocument5334 to hide the Expand buttons for rows that don't contain children. This works fine.


                                    So the next step was to add an ExpandAll button, which should expand all detail rows that have children, and also expand all grouped rows if any. I originally had the ExpandAll button use the client-side ASPxClientGridView.ExpandAllDetailRows() method, along with ASPxClientGridView.ExpandAll() for expanding all grouped rows, but I had a problem when there were grouped columns, it seemed to not work consistently (the groups would expand and then collapse again). So, I switched to using the server-side grid.ExpandAll() and grid.DetailRows.ExpandAllRows(). This works consistently.


                                    The problem is that the grid.DetailRows.ExpandAllRows() method expands every detail row, not just the ones that contain children. The reason this is a problem is that the empty DetailRows still contain some empty white space, even though I have hidden the grid inside. This looks very clunky.


                                    So, I need to either A) figure out how to only expand rows that have children, or B) make it so that empty expanded detail rows don't have the extra white space, and therefore appear indistinguishable from a collapsed row.


                                    Solution A) is turning out to be harder than I thought, and I'm stuck. I tried handling the OnDetailRowExpandedChanged event, and if there are no children, collapsing the row again, but this doesn't work, and upon debugging, it appears this event is only fired off from the client-side event, but not the server-side one. The debugger never stops on this event when using the server-side method. Does the server-side grid.DetailRows.ExpandAllRows() not throw this event? Regardless, even when I had it working using the client-side event, I couldn't figure out how to get the KeyValue of the master row of the detail row that threw the event. That is what I need in order to look up whether this detail row has children or not.


                                    I also thought about trying to handle it on display; when the row is rendered, figure it out and collapse if necessary, but couldn't find the right event for that either.


                                    Solution B) is also stumping me; I can't figure out how to turn off the empty space in an empty DetailRow.


                                    Any help would be appreciated! Thanks!

                                You must  log in  or  register  to leave comments

                                1 Solution

                                0

                                Hi Skippy,

                                Here are my comments:

                                A) The ASPxGridView does provide such a method. You can do it manually. Get a key value for each row (ASPxGridView.GetRowValues), select detail rows from you database. Expand a row (ASPxGridView.ExpandRow) if it has detail data.

                                B) Please post all messages regarding this issue to the ASPxGridView - How to get rid of an empty space in DetailRows report.

                                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