Hi @ all,
is there a way to load the childbands dynamical for every single row ?
So maybe if the user double_clicks on a parent row in a Grid, the childrows will be loaded from DB and connected to that parentrow. But not for all rows in the grid, only for the one clicked (or the selected ones at click).
I don't see any way to do that with the UltraGrid, because a Relation over two tables will be load every childs !?!
I had a look at the 1 million row example the last days, but don't get it until now.
My biggest problem is that the examples always generate the cell-values manually. How can I set the cellvalues or the whole row if I have the data in a normal system.data.datatable? Is it neccessary to convert them and if yes how?
What I have until now (dataGridDT is the dataTable with the parentrows):
Me.UltraDataSource.Band.Key = "RootBand" ' Add table columns to the root band. For Each c As System.Data.DataColumn In dataGridDT.ColumnsMe.UltraDataSource.Band.Columns.Add(c.ColumnName, c.GetType) Next If Me.UltraDataSource.Rows.Count = 0 Thengetroot(Me.UltraDataSource, Me.dataGridDT, Me.UltraDataSource.GetBandByKey("RootBand")) End If Dim childBand As UltraDataBand = Me.UltraDataSource.Band.ChildBands.Add("ChildBand") Me.UltraDataSource.Rows.SetCount(Me.dataGridDT.Rows.Count) Grid.DataSource = Me.UltraDataSource Private Sub getroot(ByVal DS As UltraDataSource, ByVal table As System.Data.DataTable, ByVal bandname As UltraDataBand) Dim row As System.Data.DataRowFor Each row In table.Rows DS.Rows.Add(New Object() {row}) Next End Sub
Me.UltraDataSource.Band.Key = "RootBand"
' Add table columns to the root band.
For Each c As System.Data.DataColumn In dataGridDT.Columns
Next
If Me.UltraDataSource.Rows.Count = 0 Then
End If
Me.UltraDataSource.Rows.SetCount(Me.dataGridDT.Rows.Count)
Grid.DataSource = Me.UltraDataSource
Dim row As System.Data.DataRow
End Sub
The "Add(New Object() {row})" throws an exception, cause it can't convert the system.datarow in a infragistics row. Or have I to loop around every column to add there values ?
Another big milestone is the loading process of my childdata. In virtualmode I have to define columns and set the rowcount before filling the cells. I know my parentcolumns (they are fixed) and the rows of my rootband should be loaded full at Initialize the UltraDataSource. But my childdata and also there columns can change depends on a select in a UltraTree. So I can't define the columns before, as well the rowcount. I want to load this childdata in a dataTable at expand-click event on a parentrow and set this values for the childdata then. is this possible?
I would be glad if anybody have some helping code or hints for me.
thanks a million
Hi Matt,
thanks for your answer. I will have a look at this sample. At the moment I add the rows at the doubleclick-event. But I think your hint with the BeforeRowExpanded event would be better. thanks
One approach would be to use an UltraDataSource and the grid's Virtual mode (see the "1 million rows" sample that ships with the Windows Forms samples). Another approach that I have seen is to not populate the row in the underlying child data source until the BeforeRowExpanded event, at which point you add the relevant data.
-Matt