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

How to trigger Ajax load of a RadComboBox and select the first item loaded.

1 Answer 146 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Richard
Top achievements
Rank 2
Richard asked on 12 Apr 2010, 09:08 PM
Hi,

After looking at the doc, I can't find all the hooks I need for a seemingly logical scenario: I have many RadComboBoxes on a page, and I need to load one or the other of them via client "onclick" events. For example, when a user clicks a checkbox, I need to load a related RadComboBox and also set the selected index to the first item loaded. I cant expect the user to check the checkbox and then also click on the RadComboBox to trigger it. Does anybody have an example or a tip how to do this? The easy part is the Ajax loading, the difficult part seems to be: fire and event to get the RadComboBox to start its ajax loading and also set the first item as selected in the ComboBox.

I have seen this post:
http://www.telerik.com/community/forums/aspnet-ajax/combobox/ajax-refresh-of-radcombobox.aspx

but aside from being very complex for a simple scenario (which I could live with), it doesn't work :-) No matter where I put the AjaxManager etc on my (non trivial) page, I get:
Please, see whether wrapping the code block, generating the exception, within RadCodeBlock resolves the error. ---> System.Web.HttpException: The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).
eb.UI.ControlCollection.AddAt(Int32 index, Control child)....
Web.UI.RadAjaxControl.MoveUpdatePanel(Control initiator, Control updated)
inner exception stack trace ---
Web.UI.RadAjaxControl.MoveUpdatePanel(Control initiator, Control updated)
...

It is wrapped, of course, just as in the example presented...


THANKS!
Richard

1 Answer, 1 is accepted

Sort by
0
Veselin Vasilev
Telerik team
answered on 13 Apr 2010, 01:42 PM
Hello Richard,

I have just replied to your support thread:

Please find attached a sample page. It contains two comboboxes and two checkboxes.

Checking the first checkbox will load the items on demand of the first combo and will select the first item.
Checking the second checkbox will load the items to the second combo with ajax (using RadAjaxManager).

Link with the page.

Best wishes,
Veskoni
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
ComboBox
Asked by
Richard
Top achievements
Rank 2
Answers by
Veselin Vasilev
Telerik team
Share this question
or