DataBinding issue with DDL and a List<T>

2 posts, 0 answers
  1. Corbin
    Corbin avatar
    1 posts
    Member since:
    Jul 2014

    Posted 18 Jan 2017 Link to this post

    I've run into a very strange issue with binding a simple List of objects to a DropDownList. Given the following code: 


    this.myDDL.DataSource = null//in here to make sure any pre-existing source isn't the problem
    List<Person> lst = new List<Person>();
    var qry = Employees.List(load); //Returns List<Person> with no errors every time
    lst.AddRange(qry.ToArray()); //Proof that there are no errors.  lst.AddRange() works flawlessly on the data
    this.myDDL.BindingContext = new BindingContext(); //just added this, in case it was the issue
    this.myDDL.DataSource = lst;  //bombs.


    The very strange thing is that the error thrown is an Oracle error.  Normally, I'd be pestering Oracle about it, but the weird bit is that it only throws the error when assigning the datasource.  This doesn't match Oracle error ORA:00933 (SQL Command not properly ended) at all, but that's the error that is thrown.  The unnecessary extra code above is entirely a result of me trying to isolate a cause, but the query itself that runs to fill in one of these objects is a Stored Procedure that is called in our Production environment many times a day in the exact same way.  The object itself is too simple to be the cause:

    public class Person
          public int ID {get;set;}
          public string FullName {get;set;}
          public override string ToString()
                 return ID.ToString() + "(" + FullName + ")";

    There are no null values in any property of the objects, no nulls added to the list, and the error doesn't occur until Binding.  Does the Telerik RadDropDownList recall the constructor of each object when using a List<T> as a DataSource? If not, why would the error appear when binding instead of when the objects are initially constructed?

  2. Dess | Tech Support Engineer, Sr.
    Dess | Tech Support Engineer, Sr.  avatar
    3765 posts

    Posted 20 Jan 2017 Link to this post

    Hello Corbin,

    Thank you for writing.  

    It doesn't seem to be a problem with RadDropDownList. I would recommend you to iterate the query result and create a new list of Person instances and then set the RadDropDownList.DataSource property. Alternatively, you can test the same scenario with the MS ComboBox.

    I have found the following threads related to this problem:

    I hope this information helps. Should you have further questions I would be glad to help.

    Telerik by Progress
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top