35
Nested WebDataGrids
posted

We would like to use a webdatagrid to represent a collection of data.

For each row in this webdatagrid, there will be two columns that will represent a sub-collection of data, which could have multiple rows.

Equate it to a row will be a certain parcel of farm property.  One of the sub-collection of data would be one or more owners of that property.  Another column of data would be the tenants that work that property, one or more.

To add complexity to it, we’d like an edit button for each owner and each tenant to be able to modify the name of each and be able to save back to the database.

Is a structure of two webdatagrids inside of one webdatagrid the proper structure?  If so, any examples of how the sub-webdatagrids are structured within the outer webdatagrid and the data is called for would be appreciated?  Or, is there a better tool to facilitate this?

Thanks in advance,

 

Don

  • 6305
    Offline posted

    Hello Don,

    Thank you for the detailed data description you have provided.

    Based on the nested collections relationship you have refered to, I can suggest you use our WebHierarchicalDataGrid (instead of the single-level WebDataGrid).
    The WebHierarchicalDataGrid is specifically designed to support and show multiple parent-child and self-referencing relationships in an expandable, hierarchical data grid.

    For example:

    class Person
    {
      ...
      public List<Item> Items { get; set; }
      public List<Bill> Bills { get; set; }
    }
    
    class Item
    {
      ...
    }
    
    class Bill
    {
      ...
    }


    I have attached a sample application, that uses a sample data hierarchy as shown in the example from above. The fields/columns for each level are manually defined and one of the child columns is defined by using the TemplateDataField and introduces a button within the cell itself.
    (Please note that you might have to change the assembly references and the stylesSetPath property in the Web.config so they target you specific version and path for the styles.)

    For more details on the control, I can suggest you take a look at Hierarchical Data Grid and our online samples regarding its functionality and features.

    If you have any questions, please let me know.

    5164.WebHierarchicalDataGrid_sample.zip