views:

15

answers:

1

I'm sure this is quite simple but I can't seem to get it to work. I'm just trying to set the selection of a RadComboBox using its onDataBound function.

protected void ReTo_DataBound(object sender, RadComboBoxItemEventArgs e)
            {
                if (e == null) throw new ArgumentNullException("e");
                var combo = sender as RadComboBox;
                if (combo.FindItemByText("Jack Johnson") != null)
                    combo.FindItemByText("Jack Johnson").Selected = true;
            }

I think i'm calling the combobox incorrectly.

Thanks for any help.

A: 

I can't solve it from here but your FindItemByText is "smelly" :), don't look for a item by his string value, it could be one char difference...

Try to check item by value not text and see what happens.

cheers

Marko
Thanks, but I've tried that. No matter what find I use it doesn't find it though i know it's in there.Fairly sure the problem is with how I'm trying to grab the combobox.
John
and also, why do you setting combobox selection ondatabound..maybe if you try the same thing in the page_load?
Marko