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

RadComboBoxItem.Selected does not set RadComboBoxText

6 Answers 91 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Missing User
Missing User asked on 12 Jul 2011, 04:00 AM
In the Page.PrerenderComplete event for !IsPostBack, I find a RadComboBoxItem and set the Selected property but the Text in the RadComboBox does not change. I can also set the RadComboBox.SelectedItemIndex and that still does not work. When the ComboBox renders, the old text is still there but when I do the drop down I see the item I selected using either method. I have degugged the control and see the properties I am setting Ok but never see the Text property change. The initial data load is bound to a SqlDataSource within the UC.

Shouldn't the ComboBox.Text follow the setting of either of these properties?

Also, this is inside of a user control on a page and it seems there have been others with the problem when inside a uc. I have another just in a regular page but not a UC and it works fine as expected.

Thanks, Dave

6 Answers, 1 is accepted

Sort by
0
Missing User
answered on 12 Jul 2011, 04:33 PM
Anyone have suggestions on how to get this to work in a UC?
0
Missing User
answered on 13 Jul 2011, 05:36 AM
Telerik - do you offer any support here? There are several complaints about this? Do you know this works or does not work? Please post something...hopefully a sample proving it works or not.
0
Dimitar Terziev
Telerik team
answered on 14 Jul 2011, 03:20 PM
Hi Dave,

The reason for the experienced behavior is due to the fact that you are trying to change the selected item too late during page life cycle. If you want to preselect a particular item, you should do this in Page_Load or Page_PreRender event.

Regards,
Dimitar Terziev
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

0
Missing User
answered on 14 Jul 2011, 03:38 PM
Thanks Dimitar. I did try Page_Load but the control is databound to an EntityDataSource and was not yet populated. Should the combobox items be loaded if databound during page_load?
0
Dimitar Terziev
Telerik team
answered on 18 Jul 2011, 01:02 PM
Hello Dave,

Have you tried setting the SelectedIndex in Page_PreRender event?

Regarding your questing when to bind the RadCombobox, yes it's preferable to use the Page_Load event.

Kind regards,
Dimitar Terziev
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

0
Linta Sheel
Top achievements
Rank 1
answered on 23 Oct 2015, 10:04 AM

I'm also getting the same error.

I'm dping the radcombobox.selectedvalue="value" in my page load.

 I can see the value selected when I click on the dropdown but not when the page is displayed.

 Pls Help..

Tags
ComboBox
Asked by
Missing User
Answers by
Missing User
Dimitar Terziev
Telerik team
Linta Sheel
Top achievements
Rank 1
Share this question
or