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

Selection Out Of Range (Even With ClearSelection)

9 Answers 131 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Jason Van Dusen
Top achievements
Rank 1
Jason Van Dusen asked on 13 Oct 2008, 02:21 PM
Okay this bug has me baffled.  I have a rad combobox on a web page.  I am getting a "Selection out of range" error in my logs.  I have added mycombobox.ClearSelection before databinding which was recommended in another post. However, the problem still exists.  Also, I can't reproduce the problem.  When I go to my site, it works fine.  However, there is something that the user is doing to get this to happen.  Any help would be greatly appreciated.  Below is my code:

            Dim blankStreet As New StreetTypeListItem
            Dim streetTypes As New StreetTypeList

            With blankStreet
                .AddressType = "N/A"
                .TypeDescription = "N/A"
            End With

            'Retrieve the list of available street types from our database.
            streetTypes = GetStreetTypes()

            If (streetTypes IsNot Nothing) Then

                Dim stTypes As New List(Of StreetTypeListItem)

                For Each streetType As StreetTypeListItem In _
                    streetTypes.StreetTypes
                    stTypes.Add(streetType)
                Next

                ddlStreetType.DataTextField = "TypeDescription"
                ddlStreetType.DataValueField = "AddressType"
                stTypes.Insert(0, blankStreet)

               ddlStreetType.ClearSelection()
               ddlStreetType.DataSource = stTypes
               ddlStreetType.DataBind()

          End If

9 Answers, 1 is accepted

Sort by
0
Simon
Telerik team
answered on 13 Oct 2008, 04:03 PM
Hi Jason Van Dusen,

Since you are clearing the selection before binding the ComboBox, there must be something else that is causing the error.

Could you log the Stack Trace of the exception and post it here as well? I believe it will give us more information about the cause.

Sincerely yours,
Simon
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Jason Van Dusen
Top achievements
Rank 1
answered on 13 Oct 2008, 04:05 PM
Thank you for the rapid reply.  The stack trace is as follows:

Exception Message:
Selection out of range
Parameter name: value
Stack Trace:
   at Telerik.WebControls.RadComboBox.PerformDataBinding(IEnumerable dataSource)
   at Telerik.WebControls.RadComboBox.OnDataSourceViewSelectCallback(IEnumerable data)
   at System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback)
   at Telerik.WebControls.RadComboBox.OnDataBinding(EventArgs e)
   at Telerik.WebControls.RadComboBox.PerformSelect()
   at System.Web.UI.WebControls.BaseDataBoundControl.DataBind()
   at Forms_StopServicesBillingInfo.PopulateStreetTypes()
Stack Trace:
   at Forms_StopServicesBillingInfo.PopulateStreetTypes()
   at Forms_StopServicesBillingInfo.SecureControlAccess()
0
Simon
Telerik team
answered on 13 Oct 2008, 04:20 PM
Hi Jason Van Dusen,

Thank you for the additional info.

The Stack Trace still points to the data binding process of the ComboBox, which is strange.

Could you isolate the issue in a working page or a small project and send it to us via a formal support ticket? We will investigate the issue more thoroughly in order to find what is causing it.

Regards,
Simon
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Jason Van Dusen
Top achievements
Rank 1
answered on 13 Oct 2008, 06:19 PM
Can you give me some hints on how to isolate this problem?  I haven't been able to determine how the user is encountering this bug.  The page works fine for me but I am getting errors in the logs.

Jason V
0
Simon
Telerik team
answered on 14 Oct 2008, 08:36 AM
Hello Jason Van Dusen,

I am sorry for not being clear enough in my previous post.

The error is already isolated in the page itself, so sending it will be enough. Additionally, please try to remove any custom code from the page, so that it can be run on our end without requiring any custom classes and/or data base. If this is not possible, please send them as well.

Best wishes,
Simon
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Leslie
Top achievements
Rank 1
answered on 09 Mar 2009, 05:58 PM
Was there ever a resolution to this issue? I seem to be having the same issue where it's failing on the DataBind and I cannot figure out how to get around the issue.
0
Jason Van Dusen
Top achievements
Rank 1
answered on 09 Mar 2009, 06:31 PM

I gave up on databinding the combobox.  It always fails.  I even tried upgrading to Q3 with the same problem.  My work around is to simply add the items manually.

For Each streetType As StreetTypeListItem In stTypes

                    Dim streetComboBoxItem As New Telerik.WebControls.RadComboBoxItem
                    With streetComboBoxItem
                        .Text = streetType.TypeDescription
                        .Value = streetType.AddressType
                    End With

                    ddlStreetType.Items.Add(streetComboBoxItem)

                Next

0
Tamish
Top achievements
Rank 1
answered on 03 Mar 2010, 07:15 PM
Was there a resolution on this issue? Adding items manually isn't a good option.

Thanks!
Tami Shaw
0
Simon
Telerik team
answered on 04 Mar 2010, 04:59 PM
Hi Tamish,

Can you provide more details about the issue you are experience as well as your RadComboBox configuration?

Have you tried calling ClearSelection before data binding?

Regards,
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
Jason Van Dusen
Top achievements
Rank 1
Answers by
Simon
Telerik team
Jason Van Dusen
Top achievements
Rank 1
Leslie
Top achievements
Rank 1
Tamish
Top achievements
Rank 1
Share this question
or