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
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.
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()
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.
Jason V
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.
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
Thanks!
Tami Shaw
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.