This is a migrated thread and some comments may be shown as answers.

Other ways to set datasource

1 Answer 59 Views
MultiColumn ComboBox
This is a migrated thread and some comments may be shown as answers.
Jo
Top achievements
Rank 1
Jo asked on 07 Jan 2015, 03:18 AM
I set the datasource of multicolumncombobox everytime dropdown opening event is fired.
But on the first instance, it only show the header and a vertical scroll like 1st.png attachment. It did have rows since if I press downbutton, a row will be selected
while on the second instance and later, it works like 2nd.png attachment.

private void combobox_DropDownOpening(object sender, System.ComponentModel.CancelEventArgs args)
        {
            combobox.DataSource = datatable;
        }

Any suggestions?

1 Answer, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 09 Jan 2015, 04:21 PM
Hi Joem,

Thank you for writing.

This is not a valid scenario and you should not set the DataSource in this event. The data source should be set before this event is fired so the drop down size can be correctly measured. Since you need to change the data source in such way I will recommend you to use the GotFocus event: 
void radMultiColumnComboBox1_DropDownOpening(object sender, CancelEventArgs args)
{
    radMultiColumnComboBox1.DataSource = null;
    radMultiColumnComboBox1.DataSource = GetTable();
    radMultiColumnComboBox1.DisplayMember = "Name";
}

I hope this helps.

Regards,
Dimitar
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
MultiColumn ComboBox
Asked by
Jo
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
Share this question
or