WinTree is bound to a DataSet that I am creating on the fly. At some I am constructing a brand new instance of the DataSet (brand new DataTables, DataColumns and DataRows) and calling tree1.SetDataBinding(dataset, null) again. If the structure of the DataTable within the DataSet is modified (columns are different), the structure of the dataset is not reflected on the screen - no matter what I do. However if the number of the DataColumns stays the same everything binds correctly. I am using UltraWinTree 8.1.20081.1000 Is that a known defect? Thanks.
Please respond to andrebii at aol.com
Thanks Mike, I was not clearing the collection of ColumnSets assuming that DataSource = null should do the trick. Reset worked out just fine for me though.
Okay, then my guess is that the new DataSet has tables with the same names as the original and so the tree is re-using the same ColumnSets. Resetting the entire tree probably works because it clears the ColumnSets. So you could probably achieve the same thing more efficiently by setting the tree's DataSource to null and then calling tree.ColumnSettings.ColumnSets.Clear() and then binding to the new data source. But if you don't mind losing all of the other settings on the tree, Reset is probably just fine.
It seems that calling tree.Reset() did the trick...
Mike, thanks for quick response. AutoGenerateColumnSets is set to true as the first time I bind a DataSet everything is shown correctly. I am NOT using the same DataSet instance as a DataSource for the tree the second time I bind data - this is completely different instance of a DataSet that I am creating on the fly and I am setting tree datasource to NULL right before I re-bind it the second time. I am pretty sure you're right about something being messed up in the tree code as the old data disappears after I bind the second dataset, but the new columns are not shown...Any other ideas? Thanks!!
Hi,
Assuming you have AutoGenerateColumnSets set to true (which is the default), then the tree is probably not recognizing that the data source has changed, since you are assigning the same instance of the dataSet as it's data source.
There are a number of ways you could handle this. One way would be to set the DataSource to null first, then back to your DataSet. You might need to clear the tree's existing ColumnSets while the DataSource is null.
Another option would be to create a new DataSet, rather than re-using the same one and clearing and rebuilding it.