My setup: I'm loading data into a DataTable at server-side. In my app I'm binding the DataTable to a UltraGridDatasource where I've defined some of the columns that are in the DataTable. The rest of the columns are dynamic in the DataTable and the amount varies depending on the data. The UltraGridDatasource is then bound to an UltraGrid.
My problem: When I bind the UltraDataSource to the grid the column caption is the same as the key in the DataTable, even though I've set a different caption for the columns I've defined in the UltraGridDatasource. It seems that the UltraGridDatasource overrides settings and uses the DataTable keys as captions for all columns when the DataTable includes dynamic (undefined) data columns.
My question: How can I mix data so that the column captions, for defined columns in the UltraGridDatasource, are based on defined values and dynamic columns use the DataTable column / UltraGridDatasource column key as the caption?
Hi,
ltoivola said:My setup: I'm loading data into a DataTable at server-side. In my app I'm binding the DataTable to a UltraGridDatasource where I've defined some of the columns that are in the DataTable. The rest of the columns are dynamic in the DataTable and the amount varies depending on the data. The UltraGridDatasource is then bound to an UltraGrid.
There's no such thing as UltraGridDatasourceas far as I know. So I assume you mean UltraDataSource here.
ltoivola said:My problem: When I bind the UltraDataSource to the grid the column caption is the same as the key in the DataTable, even though I've set a different caption for the columns I've defined in the UltraGridDatasource. It seems that the UltraGridDatasource overrides settings and uses the DataTable keys as captions for all columns when the DataTable includes dynamic (undefined) data columns.
This doesn't make sense to me. If the grid is bound to an UltraDataSource, then it has no connection or reference to your Datatable, The UltraDataSource has no way to reference a DataTable, either. So how could it possibly be using the keys from the DataTable? What you are suggesting here is simply not possible.
ltoivola said:My question: How can I mix data so that the column captions, for defined columns in the UltraGridDatasource, are based on defined values and dynamic columns use the DataTable column / UltraGridDatasource column key as the caption?
If you are binding a grid to an UltraDataSource, then the column captions and keys come from the UltraDataSource. So you can choose whatever column keys and captions you want.
You also have the option of changing the column captions in the grid via the column.Header.Caption property.
Thanks Mike,
you're right I'm using UltraDataSource that is bound to the grid. I went back to my code based on your reply and I guess the main problem is that the grid is using the column keys from the UltraDataSource as the column captions. Event though I've set different captions in the grid designer.
Any idea why the UltraDataSource keys would override the settings in the grid?It seems you cannot set a caption in the UltraDataSource designer either.