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

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

1 Answer 758 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Mohammed
Top achievements
Rank 1
Mohammed asked on 28 Jul 2017, 08:55 AM

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;
}

1 Answer, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 31 Jul 2017, 11:58 AM
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.
Tags
Grid
Asked by
Mohammed
Top achievements
Rank 1
Answers by
Eyup
Telerik team
Share this question
or