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,
Mike's suggestions helped me on to the right track and I was able to find my problem.
In the end the problem was in my setup, while using the UltraDataSource with the grid I also bound the grid with a bindingsource that held my DataTable. The scheema in the UltraDataSource did not match the DataTable structure which caused the Caption problem.
I recreated and corrected the UltraDataSource scheema and after that the Captions started working in the expected manner.
Thanx for your help..
I just wanted to know if you were able to set the Caption following the Mike’s suggestions or you still need help? Just let me know.
Sincerely,DimiDeveloper Support EngineerInfragistics, Inc.
UltraDataSource doesn't have a caption property for it's columns. This would not make any sense, since the component is not visible. :)
So the only way to set the captions on the column would be to go to the grid designer under:
Band and Column Settings -> Band [0] -> Columns
And then go to the Header property on each column and set the Caption on that.
If that's what you are doing, and the captions are not showing up at run-time, then something is wrong. But I don't believe that the keys on the columns are overriding the captions. If the captions are not showing up and the keys are, then it must be because the captions are getting lost.
The most likely explanation for that is that you are binding the grid to a different DataSource at run-time. Or perhaps you are loading a layout into the grid at run-time. Or... something in the code is changing or resetting the column header captions at run-time.
So I would check for references in your code to the DataSource property of the grid, or for the DisplayLayout.Load method, or the Caption property on the UltraGridColumn.
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.
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.