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

Selection out of range

4 Answers 143 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 May 2008, 10:04 PM
On my web site some users are getting a "Selection out of range" error on one of my combo boxes when I populate it with values.  I can' seem to reproduce this error.  Any ideas on what might cause this problem?  Below is the code that I am using to populate the combobox.    Any help would be greatly appreciated.

Jason

Dim blankStreet As New mystreetTypeObject
Dim streetTypes As New myStreetTypeObjectList

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 mystreetTypeObject)

For Each streetType As mystreetTypeObject In myStreetTypeObjectList.StreetTypes

stTypes.Add(streetType)

Next
 
ddlStreetType.DataTextField = "Description"
ddlStreetType.DataValueField = "AddressType"

 stTypes.Insert(0, blankStreet)

ddlStreetType.DataSource = stTypes
ddlStreetType.DataBind()

Else

Throw New Exception("Unable to retrieve the list of available street types.")

End If

4 Answers, 1 is accepted

Sort by
0
Veselin Vasilev
Telerik team
answered on 15 May 2008, 11:14 AM
Hello Jason,

I am afraid the provided information is not enough for me to determine what could be the cause of the problem.
If you could strip your project to a small and runnable one and send it to us - we will test it locally.

Best wishes,
Veskoni
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Rory
Top achievements
Rank 1
answered on 29 May 2008, 06:42 PM
I was having the same issue. I fixed it by removing the ComboBox outside of my Ajaxified <DIV> Seems like when its ajaxified if you can change selections really fast or enter some junk text and it will throw this error.
0
Jason Van Dusen
Top achievements
Rank 1
answered on 29 May 2008, 10:44 PM
Thank you very much for the reply.  How do you remove it from the Ajaxified div?  What exactly do you mean by that?  Are you referring to an update panel?  Talk to you soon

Jason
0
Rory
Top achievements
Rank 1
answered on 29 May 2008, 11:56 PM

I'll try to demonstrate in code. So i set the ajaxmanger to a DIV pretty much behaves just like a panel. Somebody recommended this to me in the past but I'd beware it seems to create some interesting side effects like this. So when I say I removed it from being Ajxified I just simply take it outside of the DIV and its no longer being Ajaxified by my AjaxManager.

<div id="ajaxdiv" runat="server">  
 
                        <telerik:RadComboBox ID="cboRecipient" runat="server"   
                            EnableEmbeddedSkins="false" 
                            EnableLoadOnDemand="true" 
                            AllowCustomText="true" 
                            Height="150px"   
                            MarkFirstMatch="true" 
                            OnClientBlur="SetDiaryCount" 
OnClientSelectedIndexChanged="FireComboBoxCustomRequiredFieldValidator">  
                        </telerik:RadComboBox>                      
 
                        <asp:CustomValidator ID="cvRecipient" runat="server"   
                            ClientValidationFunction="ComboBoxCustomRequiredFieldValidator"   
                            ControlToValidate="cboRecipient"   
                            Display="Dynamic"   
                            EnableClientScript="true" 
                            ValidateEmptyText="true"   
                            ErrorMessage="<br />Valid Recipient is required">  
                        </asp:CustomValidator> 
 
</div> 
 
 
<telerik:RadAjaxManager EnablePageHeadUpdate="false" ID="Rap1" runat="server" ClientEvents-OnResponseEnd="DisplayMessages" EnableAJAX="true" EnableEmbeddedScripts="true" EnableTheming="true">  
                <AjaxSettings> 
                    <telerik:AjaxSetting AjaxControlID="ajaxDiv">  
                        <UpdatedControls> 
                            <telerik:AjaxUpdatedControl ControlID="ajaxDiv" 
                                      LoadingPanelID="alp1" /> 
                        </UpdatedControls> 
                    </telerik:AjaxSetting> 
                </AjaxSettings> 
 </telerik:RadAjaxManager> 
 
Tags
ComboBox
Asked by
Jason Van Dusen
Top achievements
Rank 1
Answers by
Veselin Vasilev
Telerik team
Rory
Top achievements
Rank 1
Jason Van Dusen
Top achievements
Rank 1
Share this question
or