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

RadComboBox Selection out of range Error

1 Answer 94 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
DanR
Top achievements
Rank 1
DanR asked on 22 Oct 2010, 03:50 AM
Hi:

I am testing a RadComboBox inside of a basic formview that is for a drop down selection of the months in a year. I want to display the months in the year in the combobox, then store the corresponding value in the database (e.g. If March is selected, then store "3").

I have set up the radcombobox as follows:

<telerik:RadComboBox ID="RadComboBox1"
                     runat="server"
                     Label="Month"
                     SelectedValue='<%# Bind("Month") %>'
                     LabelCssClass="right_Aligned_Labels"
                     MaxLength="2"
                     >
                     <Items>
                        <telerik:RadComboBoxItem runat="server" text="January" value="1" />
                        <telerik:RadComboBoxItem runat="server" text="February" value="2" />
                        <telerik:RadComboBoxItem runat="server" text="March" value="3" />
                        <telerik:RadComboBoxItem runat="server" text="April" value="4" />
                        <telerik:RadComboBoxItem runat="server" text="May" value="5" />
                        <telerik:RadComboBoxItem runat="server" text="June" value="6" />
                        <telerik:RadComboBoxItem runat="server" text="July" value="7" />
                        <telerik:RadComboBoxItem runat="server" text="August" value="8" />
                        <telerik:RadComboBoxItem runat="server" text="September" value="9" />
                        <telerik:RadComboBoxItem runat="server" text="October" value="10" />
                        <telerik:RadComboBoxItem runat="server" text="November" value="11" />
                        <telerik:RadComboBoxItem runat="server" text="December" value="12" />
                     </Items>
</telerik:RadComboBox>

My formview is set to default to edit mode. The record I am testing with has the month column value set to "9" so I know the value is in the item list. However, when I run this program I get the error:

Selection out of range
Parameter name: value

I have looked at many posts on this issue, but I still do not know why I am getting this error. The database column I am binding to definitely has a valid value in it (e.g. "9") which should cause "September" to display based on the current record. Yet, I get this error.

This seems like such a simple requirement. How can I get this working?

Thanks, Dan

Here is the stack trace:

[ArgumentOutOfRangeException: Selection out of range
Parameter name: value]
   Telerik.Web.UI.RadComboBox.PerformDataBinding(IEnumerable dataSource) +172
   Telerik.Web.UI.RadComboBox.OnDataSourceViewSelectCallback(IEnumerable data) +471
   System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +31
   Telerik.Web.UI.RadComboBox.OnDataBinding(EventArgs e) +1234
   Telerik.Web.UI.RadComboBox.PerformSelect() +37
   System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +73
   Telerik.Web.UI.RadComboBox.DataBind() +68
   System.Web.UI.Control.DataBindChildren() +211
   System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) +102
   System.Web.UI.Control.DataBind() +15
   System.Web.UI.Control.DataBindChildren() +211
   System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) +102
   System.Web.UI.Control.DataBind() +15
   System.Web.UI.Control.DataBindChildren() +211
   System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) +102
   System.Web.UI.Control.DataBind() +15
   System.Web.UI.Control.DataBindChildren() +211
   System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) +102
   System.Web.UI.WebControls.FormView.CreateChildControls(IEnumerable dataSource, Boolean dataBinding) +1461
   System.Web.UI.WebControls.CompositeDataBoundControl.PerformDataBinding(IEnumerable data) +57
   System.Web.UI.WebControls.FormView.PerformDataBinding(IEnumerable data) +12
   System.Web.UI.WebControls.DataBoundControl.OnDataSourceViewSelectCallback(IEnumerable data) +114
   System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +31
   System.Web.UI.WebControls.DataBoundControl.PerformSelect() +142
   System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +73
   System.Web.UI.WebControls.FormView.DataBind() +4
   System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +82
   System.Web.UI.WebControls.FormView.EnsureDataBound() +166
   System.Web.UI.WebControls.CompositeDataBoundControl.CreateChildControls() +72
   System.Web.UI.Control.EnsureChildControls() +87
   System.Web.UI.WebControls.CompositeDataBoundControl.get_Controls() +15
   Telerik.Web.UI.RadFormDecorator.FindDataControls(Control parent) +80
   Telerik.Web.UI.RadFormDecorator.FindDataControls(Control parent) +437
   Telerik.Web.UI.RadFormDecorator.FindDataControls(Control parent) +437
   Telerik.Web.UI.RadFormDecorator.FindDataControls(Control parent) +437
   Telerik.Web.UI.RadFormDecorator.FindDataControls(Control parent) +437
   Telerik.Web.UI.RadFormDecorator.FindDataControls(Control parent) +437
   Telerik.Web.UI.RadFormDecorator.FindDataControls(Control parent) +437
   Telerik.Web.UI.RadFormDecorator.DecorateAspNetDataControls() +68
   Telerik.Web.UI.RadFormDecorator.ControlPreRender() +758
   Telerik.Web.UI.RadWebControl.OnPreRender(EventArgs e) +47
   System.Web.UI.Control.PreRenderRecursiveInternal() +80
   System.Web.UI.Control.PreRenderRecursiveInternal() +171
   System.Web.UI.Control.PreRenderRecursiveInternal() +171
   System.Web.UI.Control.PreRenderRecursiveInternal() +171
   System.Web.UI.Control.PreRenderRecursiveInternal() +171
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +842

1 Answer, 1 is accepted

Sort by
0
Simon
Telerik team
answered on 26 Oct 2010, 03:49 PM
Hello Dan Roth,

Can you please see the attached project in which I tried reproducing the issue you are having? Am I missing something in the setup?

All the best,
Simon
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
DanR
Top achievements
Rank 1
Answers by
Simon
Telerik team
Share this question
or