Ticket T577014
Visible to All Users

ASPxGridListEditor - RowIndex in BandsLayout or adding multi-level columns in an ASP.NET ListView

created 7 years ago

Hi, I am currently experimenting with BandsLayout in ASP.NET and had to read that RowIndex is only available in WinForms. Is there a plan to implement this in Webgrids?

Comments (2)
Dennis Garavsky (DevExpress) 7 years ago

    Hello Patrick,

    You are correct that the IModelBandedColumnWin.RowIndex option is available for WinForms only. That is because the underlying ASPxGridView component we use in Web ListView (ASP.NET Controls and MVC Extensions > ASP.NET WebForms ControlsGrid View > Concepts > Data Representation Basics > Columns > Bands ) does not allow arranging column headers across rows in ASP.NET applications like in its WinForms GridControl counterpart.

    Would you please attach a screenshot of the grid layout you want to achieve in the end? It is possible that it can be accomplished without this option, probably by writing code. We want to help you and look forward to hearing from you.

    I am also changing the ticket's product from XAF to ASPxGridView so that the team could be aware of your requirements and could suggest the best solution as far as ASPxGridView is concerned once you reply. As for the XAF integration, you will likely be able to use the Extend Functionality > Access Grid Control Properties approach or a custom ViewItem/ListEditor from the Concepts > UI Construction > Using a Custom Control that is not Integrated by Default article. Do not hesitate to contact us further if you experience any XAF integration difficulties.

    Dennis Garavsky (DevExpress) 7 years ago

      Hello Patrick,

      I have found out that this functionality was actually supported by the ASPxGridView component in v16.1. I apologize for all the inconvenience here. I will try to make a simple XAF example for you. Please bear with me.

      Answers approved by DevExpress Support

      created 7 years ago

      Hello Patrick,

      I have created a ViewController, which I tested with our FeatureCenter.Web app. Consider these implementation steps:

      1. In the YourSolutionName.Module.Web project, edit Model.DesignedDiffs.XAFML file using the Model Editor. Create required bands and add first-level columns into them. Do not add second-level columns into the same band, because we will do this in code. See the Model.XAFML file for more details:
      XML
      <Views> <ListView Id="BandTestObject_ListView"> <Columns> <ColumnInfo Id="ProductID" OwnerBand="Band1" /> <ColumnInfo Id="UnitPrice" OwnerBand="Band2" /> </Columns> <BandsLayout Enable="True"> <Band Id="Band1" IsNewNode="True" /> <Band Id="Band2" IsNewNode="True" /> </BandsLayout> </ListView> </Views>

      2. Add the ViewController1.cs file to same project. Notice that we are locating the first-level column and add another orphan column into it programmatically:

      C#
      var column11 = editor.Grid.Columns["ProductName"]; if(column1.Columns["ProductName"] == null) { column1.Columns.Add(column11); }

      NOTE: we are handling the ModelSaving event to cancel saving these changes back to the Application Model. Runtime customizations made by end-users via the column/band chooser will NOT be saved by default. That is because the default ListView model does not provide any data structures to save this bands information + the ASPxGridListEditor itself does not provide such logic by default. If this functionality is important for you, you will need to perform additional implementation and testing. My example just shows a possible way to add bands to ASPxGridListEditor and I did not test it under all the possible standard scenarios. Having said that, you may consider other alternative solutions for this task, e.g. using a custom user control: How to: Show a Custom Data-Bound Control in an XAF View (ASP.NET)

        Show previous comments (1)
        Dennis Garavsky (DevExpress) 7 years ago

          Thanks, Patrick. I am looking forward to hearing from you.

          C C
          Christoph Weinzierl-Heigl [msg] 7 years ago

            This would be such a nice feature to have in XAF Web apps too. Since it appears this is supported in ASPxGridView since 16.1, it would be so cool if we could define these band layouts using the Model Editor in the same way we do for XAF Win apps. Pretty please :)

            Dennis Garavsky (DevExpress) 7 years ago

              Thanks for your feedback, Christoph.

              Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

              Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.