Sorting error when datasource is a sub-object collection

2 posts, 0 answers
  1. Phi
    Phi avatar
    19 posts
    Member since:
    Jun 2007

    Posted 05 Jul 2007 Link to this post

    Hello again,

    My datasource is a collection of objects, with sub-objects. The databinding is OK, but when I click the row header to perform sorting, an exception is raised.

    The following code is the same as the one in the Telerik examples under RadGridView->DataBinding (select sub-object datasource)

    ArrayList list = new ArrayList();  
    list.Add(new MyObj("1"));  
    list.Add(new MyObj("2"));  
    list.Add(new MyObj("3"));  
    list.Add(new MyObj("4"));  
    list.Add(new MyObj("1"));  
    radGridView1.MasterGridViewTemplate.Columns.Add(new GridViewTextBoxColumn("Inner1.TestProp"));  
    radGridView1.MasterGridViewTemplate.Columns.Add(new GridViewTextBoxColumn("Inner1.Inner2.TestProp"));  
    radGridView1.MasterGridViewTemplate.Columns.Add(new GridViewTextBoxColumn("Inner1.Inner2.Inner1.TestProp"));  
    radGridView1.MasterGridViewTemplate.Columns.Add(new GridViewTextBoxColumn("TestProp"));  
    radGridView1.DataSource = list;  

    and the MyObj object is defined as:

    public class MyObj  
        public string _innerText = "";  
        public MyObj() {}  
        public MyObj(string text)  
            _innerText = text;  
        public MyObj Inner1  
                return new MyObj(this._innerText + "Inner1");  
        public MyObj Inner2  
                return new MyObj(this._innerText + "Inner2");  
        public string TestProp  
                return this._innerText;  

    I notice the following:

    When I try to sort any column bound to a sub-object (ie. any of the first 3 columns), I get one of the following errors:
    "Cannot find the column Inner1.TestProp"
    "Cannot find the column Inner1.Inner2.TestProp"
    "Cannot find the column Inner1.Inner2.Inner1.TestProp"

    The final column sorts OK.

    I also noticed that when I run this demo from within Telerik examples, I don't get an exception, but the sorting doesn't work properly for the first 3 columns.


  2. Julian Benkov
    Julian Benkov avatar
    1135 posts

    Posted 06 Jul 2007 Link to this post

    Hello Phi,

    the fix will be available in Q1 SP2 release. Thank you for the feedback. Your points have been updated.

    Julian Benkov
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  3. DevCraft R3 2016 release webinar banner
Back to Top