I need to add row into ultragrid. How to do this? I found only grid.Rows.Band.AddNew method - but it is adding only to the top band
I'm looping all the rows in the Grid and trying to add one or more child rows to the current row when it is necessary. I do not want to create parent and child tables and set the relationship in the dataset. I would like to add child rows while looping. This way I can create multilevel Treeview. How do I accomplish this programmatically? Thanks.
Hi,
You cannot add rows to the grid without those rows (and bands) existing in the data source. There's no such thing as an unbound row or an unbound band.
I think your best option here would be to bind the grid to an UltraDataSource, rather than a DataSet. You still need to define the Bands and columns, but it will be easier to simply add child rows in a hierarchy rather than having to define the relationships in the DataSet.
Another option you might want to consider is using the UltraTree instead of the UltraGrid. The tree lacks certain functionality such as grouping and summaries, but if you want to manually populate the control and you don't need those features, the tree has the advantaged of not needing to be bound.
I have a grid already populated with data from data source. What I'm trying to do is going through each row and see if there is any data related to that row. If there's any I would insert them as it's child rows. And I would like to do the same for the child rows too creating in a hierarchy.I want to have something like this in the grid.
1 Material A ( Band 0 )
1 Material B (Band 1 )
2 Material C ( Band 1)
1 Material D (Band 2)
1 Material E ( Band 3)
How do I do this dynamically when loading the grid. Ultragrid does have any function calls to achieve like that? I'm using v 8.1. Thanks.
I'm not sure I understand what you are trying to do. You cannot have a row in the grid that does not also exist in the grid's DataSource.
If you have some external data that is somehow "related" to the data in a grid row, then you cannot add that data to the grid as a child row unless your data source contains a child band for that row. So the child band must be defined in your data source and the child row data must also be added to the data source.