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
903
Complex Business Object as datasource in UltraCombo, how to retrieve the nested list<> ?
posted

I enclose a sample.

My question should be pretty simple to datasource master but I'm quite a newbie in datasource world :)

 

I've a business object A that is composed of List<B> and List<C>  nested objects and an Id property. When binded as datasource, I can see only A as a column of the Ultracombo (seems logical).

I though I would see other bands to display List<B> and list<C> but it does not appear. I don't know how to retrieve the list from the selected row (as I can't use SelectedRow.Cells[columnName].Value as it doesn't appear as a column.

 

How do you proceed to retrieve the other parts of a "complex" object that has been loaded into a datasource and selected in the combo ?

Thanks for your tips :)

WindowsFormsApplication4.zip
Parents
  • 69832
    Verified Answer
    Offline posted

    You could handle (for example) the ValueChanged event, get a reference to the underlying list object from the selected row's ListObject property, then upcast to the type of your business object:

    Example:
    void ultraCombo1_ValueChanged(object sender, EventArgs e)
    {
        UltraCombo combo = sender as UltraCombo;
        UltraGridRow selectedRow = combo != null ? combo.SelectedRow : null;
        if ( selectedRow != null )
        {
            A objectA = selectedRow.ListObject as A;
        }
    }

Reply Children
No Data