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

Selection out of range?

4 Answers 132 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
mac
Top achievements
Rank 1
mac asked on 19 Sep 2008, 12:10 AM
having what I consider a strange problem 4 ctrls on page. 2 are radcombo, 2 are dropdown. I am using the exact same SQL and datatables for both controls. the 2 drop downs are there for testing purposes.

essentially when index is changed on combo1, it should repopulate combo 2, which works just fine with regular dropdown. Please don't suggest the demo that populate the countries as this is what  was already used as a guideline. like i said the two drop downs work jsut fine.

the error I keep getting is as soon as i enable line 15..
error is Selection out of range
Parameter name: value
 
JDCDD.DataBind()

thanks for any thoughts. mac

  Sub loaddpts()  
        Dim dt As New Data.DataTable  
        functions.FillDT(dt, ConnStrings.ConnectionStrings, "Select Distinct Department from leaders_employees where user_empid = '" & Session("EMPID") & "'")  
        CCDropDown.DataTextField = "Department" 
        CCDropDown.DataValueField = "Department" 
        CCDropDown.DataSource = dt 
        CCDropDown.DataBind()  
    End Sub  
 
    Sub fillJDCS(ByVal x As String)  
        Dim dptds As New Data.DataTable  
        Dim SQL As String = "Select Distinct sp_job_code,job_title from leaders_employees where department = '" & x & "' and  user_empid = '" & Session("EMPID") & "'"  
        functions.FillDT(dptds, ConnStrings.ConnectionStrings, SQL)  
        JDCDD.DataSource = dptds 
       ' JDCDD.DataValueField = "sp_job_code" 
        JDCDD.DataTextField = "Job_title" 
        JDCDD.DataBind()  
    End Sub  
 
    Protected Sub CCDropDown_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles CCDropDown.Load  
        If Not IsPostBack Then  
            loaddpts()  
        End If  
 
    End Sub  
 
    Protected Sub CCDropDown_SelectedIndexChanged1(ByVal o As Object, ByVal e As Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs) Handles CCDropDown.SelectedIndexChanged  
        fillJDCS(CCDropDown.SelectedValue)  
    End Sub  
 
    Protected Sub JDCDD_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles JDCDD.Load  
        If Not IsPostBack Then  
            fillJDCS(CCDropDown.SelectedValue)  
        End If  
    End Sub  
 
 
 
 
 
    Protected Sub DD1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles DD1.Load  
        If Not IsPostBack Then  
            Dim dt As New Data.DataTable  
            functions.FillDT(dt, ConnStrings.ConnectionStrings, "Select Distinct Department from leaders_employees where user_empid = '" & Session("EMPID") & "'")  
            DD1.DataSource = dt 
            DD1.DataTextField = "department" 
            DD1.DataValueField = "department" 
            DD1.DataBind()  
        End If  
    End Sub  
 
 
    Protected Sub DD2_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles DD2.Load  
        If Not IsPostBack Then  
            filldd2(DD1.SelectedValue)  
        End If  
    End Sub  
 
 
 
    Protected Sub DD1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DD1.SelectedIndexChanged  
        filldd2(DD1.SelectedValue)  
    End Sub  
 
    Sub filldd2(ByVal x As String)  
        Dim dt As New Data.DataTable  
        functions.FillDT(dt, ConnStrings.ConnectionStrings, "Select Distinct sp_job_code,job_title from leaders_employees where department = '" & x & "' and  user_empid = '" & Session("EMPID") & "'")  
        DD2.DataSource = dt 
        DD2.DataTextField = "job_title" 
        DD2.DataValueField = "sp_job_code" 
        DD2.DataBind()  
 
    End Sub 

4 Answers, 1 is accepted

Sort by
0
mac
Top achievements
Rank 1
answered on 19 Sep 2008, 12:15 AM
naturally as soon as I post the issue.. after 3 hours trying to figure it out. I come up with
radcomboboxName.ClearSelection()
putting this at the head of the rebind, made all the difference.
0
Rosi
Telerik team
answered on 19 Sep 2008, 07:41 AM
Hi Mac,

You can aslo try our latest internal build.
If you use it you won't need the ClearSelection method.

Regards,
Rosi
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
parimal
Top achievements
Rank 1
answered on 26 Sep 2008, 07:34 PM
Hi,

We are having same issue in 2008.2.826.35 version.

Is the issue fixed in new DLL?

regards,

Parimal
0
Rosi
Telerik team
answered on 29 Sep 2008, 07:47 AM
Hello Parimal,

The fix is not included in 200.2.826 version. It will be included in the next official release.
You can also try the build attached in this thread.

Regards,
Rosi
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
ComboBox
Asked by
mac
Top achievements
Rank 1
Answers by
mac
Top achievements
Rank 1
Rosi
Telerik team
parimal
Top achievements
Rank 1
Share this question
or