Getting Your Selected Object From A Telerik MultiColumnComboBox

Wow! I’m actually writing code! 🙂

I thought this little snippet would be useful for anyone that is binding a custom collection of objects to a Telerik MultiColumnComboBox. If you want to get the selected item as your actual class – the custom class that you wrote and bound as a collection to the list, you can use this basic code:

private void MyComboBox_SelectedIndexChanged(object sender, EventArgs e)
   GridViewDataRowInfo rowInfo = MyComboBox.SelectedItem as GridViewDataRowInfo;
   if (rowInfo != null)
       MyClass myClass = rowInfo.DataBoundItem as MyClass;
       //do something with the 'myClass' variable, here.

Hopefully this will save someone else some time in the debugger trying to figure out why ‘SelectedItem’ is not coming back as the class instance that was selected.

Favor Defect Prevention Over Quality Inspection And Correction