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

having trouble with a bound RadComboBox

1 Answer 78 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
john asked on 30 Aug 2008, 08:10 PM
I have a form that has 2 rad comboboxes each bound to its own datasource control.
The second RadCombo's datasource's select parameter takes its value from the SelectdValue of the first RadCombo and then is suposed to supply a new list of items to the second RadCombo.

The second RadCombo also has 1 Static Item and has the AppendDataBoundItems set to "true"

The problem is when I change the selectedInmdex of the first RadCombo and the second RadCombo gets databound, it then Adds the new Items to the second RadCombo instead of replacing them

So as a user clicks and clicks at the different items of the first RadCombo, the list item of the secon Radcombo keep on growing and the items even get duplicated if the same listitem on the first RadCombo gets clicked more than once.

It needs to first clear the list of items before it rebind to the new data.

How do I do this?

<asp:ObjectDataSource ID="ObjectDataSource2" runat="server"

SelectMethod="GetAdSubCats" TypeName="MB.TheBeerHouse.BLL.Ads.AdSubCat">


<asp:ControlParameter ControlID="CatSelect" Name="AdCatID" PropertyName="SelectedValue"

Type="Int32" />




telerik:RadComboBox ID="SubcatSelect" runat="server"

DataSourceID="ObjectDataSource2" DataTextField="Title" DataValueField="ID"

AppendDataBoundItems="True" AutoPostBack="True" Skin="Hay">


<telerik:RadComboBoxItem Text="Select an Ad Heading" Value="0" />


<CollapseAnimation Duration="200" Type="OutQuint" />


1 Answer, 1 is accepted

Sort by
Telerik team
answered on 02 Sep 2008, 10:37 AM
Hi John,

I suggest you set AppendDataBoundItems to false, subscribe to OnDataBound event and then in its handler add the first item with text "Select an Ad Heading" like this:

protected void SubcatSelect_DataBound(object sender, EventArgs e)  
    RadComboBoxItem firstItem = new RadComboBoxItem("Select an Ad Heading""0");  
    SubcatSelect.Items.Insert(0, firstItem);  

and remove this item from the combobox definition, because it will be added dynamically.

I hope this helps.

Kind regards,
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Asked by
Top achievements
Rank 1
Answers by
Telerik team
Share this question