开发者

Setting selection in a rad combo box

开发者 https://www.devze.com 2023-01-17 22:53 出处:网络
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.

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")开发者_JS百科 != null)
                    combo.FindItemByText("Jack Johnson").Selected = true;
            }

I think i'm calling the combobox incorrectly.

Thanks for any help.


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

0

精彩评论

暂无评论...
验证码 换一张
取 消