Cannot find any bindable properties in an item from the datasource when binding to List

2 posts, 0 answers
  1. Mohammed
    Mohammed avatar
    2 posts
    Member since:
    Aug 2015

    Posted 28 Jul 2017 Link to this post

    I am trying to bind a List as the database for my RadGrid and I am getting the following error "Cannot find any bindable properties in an item from the datasource" although I have made sure and tested that the data source is returning valid data.

    <telerik:RadGrid ID="grdTest" runat="server"  AutoGenerateColumns="true" ShowStatusBar="True" OnNeedDataSource="grdTest_NeedDataSource" >
        <MasterTableView AutoGenerateColumns="true" >
        </MasterTableView>
    </telerik:RadGrid>

     

    protected void grdTest_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
    {
        int ParentRulCode = 2611767;
        List<Enrolment> MyEnrol = EnrolmentRepository.GetChildEnrolmentsFromRulCode(ParentRulCode);
     
        grdTest.DataSource = MyEnrol;
    }

     

     

    Here is My Enrolment Class

    public class Enrolment
    {
        public Course MC;
        public Person MP;
        public int RulCode;
        public DateTime StartDate;
        public DateTime EndDate;
        public string ProgressStatus;
    }
  2. Eyup
    Admin
    Eyup avatar
    3988 posts

    Posted 31 Jul 2017 Link to this post

    Hi Mohammed,

    I've already replied to this query in your formal support ticket, but I am also pasting the solution here so other developers could see it as well:

    You can fix the issue by replacing the fields with properties:
    public class Enrolment
    {
        public string MC { get; set; }
        public string MP { get; set; }
        public int RulCode { get; set; }
        public DateTime StartDate { get; set; }
        public DateTime EndDate { get; set; }
        public string ProgressStatus { get; set; }
    }

    I've also created a sample RadGrid web site to demonstrate that the suggested solution works as expected.
     
    Regards,
    Eyup
    Progress Telerik
    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