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

Selection out of range error

5 Answers 169 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
EmpowerIT
Top achievements
Rank 2
EmpowerIT asked on 16 Jan 2008, 04:18 AM
I'm getting a Selection Out of Range error when trying to do something very simple with the DropDown control.

Based on a radio selection list, the items in the drop down list should change. The items are retrieved from a datasource, however i manually add the "All" item to the list. The code is below:

 void JobsList_SelectedIndexChanged(object sender, EventArgs e) 
    { 
        FilterCombo.AppendDataBoundItems = true
        FilterCombo.Items.Clear(); 
        RadComboBoxItem myItem = new RadComboBoxItem("All""-1"); 
        FilterCombo.Items.Insert(0, myItem); 
        FilterCombo.Items[0].Selected = true
        if (JobsList.SelectedValue == "1"
        { 
            FilterCombo.DataSource = TechniciansSource; 
            FilterCombo.DataTextField = "TechName"
            FilterCombo.DataValueField = "TechnicianId"
            FilterCombo.DataBind(); 
        } 
        else 
        { 
            FilterCombo.DataSource = SuburbSource; 
            FilterCombo.DataTextField = "Suburb"
            FilterCombo.DataValueField = "SuburbId"
            FilterCombo.DataBind(); 
        } 
             
    } 

Similar code is called when the page first loads (!IsPostBack), and there is no problem. The exception is thrown once it tries to execute the FilterCombo.DataBind() method.

Any help would be appreciated

5 Answers, 1 is accepted

Sort by
0
EmpowerIT
Top achievements
Rank 2
answered on 16 Jan 2008, 04:26 AM
I can confirm that this is a bug/missing feature, as the exact same code works with the RadComboBox for RadControls for ASP.NET Q32007
0
Martin
Top achievements
Rank 2
answered on 16 Jan 2008, 08:50 AM
Have you tried doing the databind and then inserting your "All" item after that?

Martin
0
Rosi
Telerik team
answered on 16 Jan 2008, 11:37 AM
Hi ,

Please try the latest build attached to this message and let us known how it goes.

Cheers,
Rosi
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
EmpowerIT
Top achievements
Rank 2
answered on 16 Jan 2008, 11:11 PM
Hi,
That hotfix seems to have fixed it, was it a bug?

Will this fix be available in the next release? Approximately when is the next release?
0
Nikolay
Telerik team
answered on 17 Jan 2008, 09:21 AM
Hello EmpowerIT,

Actually, this fix has been included in the SP1 release launched yesterday. We always include such fixes in the forthcoming versions of the controls.

Sincerely yours,
Nick
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
ComboBox
Asked by
EmpowerIT
Top achievements
Rank 2
Answers by
EmpowerIT
Top achievements
Rank 2
Martin
Top achievements
Rank 2
Rosi
Telerik team
Nikolay
Telerik team
Share this question
or