Current filter:
                                You should refresh the page.
                                Support Center
                                0
                                  • I have a form with an xtraGrid, where users can select from a list of tables that includes every major section of the application. The data is then shown in an xtraGrid, allowing them to sort, filter, and export the information in a report. Effectively, it's a one-stop-shop reporting tool for the entire application.

                                    Obviously I need to be able to bind the xtraGrid to datasource at will, and update the xtraGrid bands and columns to match the new data. To do this, I start with a completely blank xtraGrid. No bands, no columns, no nothing. Everything is created at runtime.

                                    Once the user selects a set of tables to view and presses a button, a provide the datasource they request. Then I begin to format the columns so everything looks pretty. I set the column headers, hide the columns they don't need to see, etc. Then I add bands into which I can group the columns, and add the columns into the bands.

                                    Here is the part I'm having trouble with:

                                    [VB.NET]
                                    '...(other columns that are NOT hidden are handled above, but cut for space.) .Columns("EPSDetail_Report").Visible = False .Columns("EPSDetail_Report").OptionsColumn.AllowShowHide = False .Columns("EPSDetail_Report").OptionsColumn.ShowInCustomizationForm = False Dim bandNewEPS As GridBand = gridNew.Bands.AddBand("EPS") bandNewEPS.Columns.Add(gridNew.Columns("EPSDetail_Description")) bandNewEPS.Columns.Add(gridNew.Columns("EPSDetail_Responsible")) bandNewEPS.Columns.Add(gridNew.Columns("EPSDetail_Status"))

                                    As you can see, I add a band called "EPS". Then I add three columns to that band.

                                    When the code executes the band is created, but the columns are not moved under the band. Instead, they remain in the column customizer. I have to manually drag them under the "EPS" band, where they appear correctly. 

                                    Obviously we don't want the user to have to manually drag his columns onto the grid, we want them to have a default setup. What could be causing this kind of issue?

                                    Please remember that, while my example above only shows the column "EPSDetail_Report", and that column is hidden, columns "EPSDetail_Description", "EPSDetail_Responsible", and "EPSDetail_Status" are not hidden, are shown in the customizer, and should be appearing in the "EPS" band as the code displays.

                                    Thanks!
                                • Stas (DevExpress Support) 01.11.2017

                                  Hello,
                                  I'm afraid I cannot say for sure why this behavior occurs on your side based on the provided code.
                                  However, this behavior can occur in case the newly created column is hidden. For instance, if you create columns with the use of the BandedGridView.Columns.AddField method, the created columns are hidden by default. In this case, you need to make them visible manually.

                                  If your scenario is different,Would you please review the attached project and modify it if I missed anything? This will allow us to find a precise solution for you much faster.
                                  I look forward to your response.

                                1 Solution

                                Creation Date Rating Importance Sort by
                                0

                                Hello Dustin,

                                To solve the issue, you need to explicitly set the Visible property:

                                [VB.NET]
                                ..... viewNew.Columns("EPSDetail_Description").Visible = true 'at the end of your code

                                 

                                In addition, please note that it's better to wrap your code in the View.BeginUpdate/EndUpdate statement to improve its performance.

                                Let me know if you have additional questions.

                                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, ASP.NET, WinForms, HTML5 or Windows 10, DevExpress tools help you build and deliver your best in the shortest time possible.

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