Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
410
InitializeLayout firing for Ultradatasource
posted

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 ....

Parents
  • 469350
    Offline posted

    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?

Reply Children