I have an ultradatasource. I load it with data from the database. I attach it to a datasource for the grid, but if I have no records, the initializelayout does not fire (which means my add new line does not appear). What should I be doing?
Roger
udsPatientProblemList.Rows.SetCount(intCount)
grdPatientProblemList.DataSource = .udsPatientProblemList
-- InitialLayout is not fired with 0 records. If I have records it fires. I can force it with a databind, but ....
Hi,
InitializeLayout should fire when you set the DataSource on the grid, regardless of the number of records in the data source.
But I am a little confused by your post. What do you mean by this?
rogerbundy said:I have an ultradatasource. I load it with data from the database.
Are you saying that you are copying your data into the UltraDataSource? If so, then you should not be calling SetCount on the Rows collection. That method is only supposed to be used when you are loading the data on-demand.
If you are loading the data on-demand and the intCount in your example here is 0, then I think InitializeLayout should still fire, as long as the UltraDataSource has bands and columns in it and the grid did not already have a data source with the exact same data structure.
BTW, what version of the controls are you using?
I am having an issue building up an UltraDataSource and getting it to populate a datagrid also. I can get columns to show in the base band, but the child bands do not show. My initialize does fire for finishing some things I want to do. I have not yet got to populating data. I am trying to make sure I get the structure right first. I have this in a recreatable project which is attached. BTW, v10.3