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

neither a datacolumn nor a datarelation for table

1 Answer 637 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Suzy
Top achievements
Rank 2
Suzy asked on 15 Dec 2014, 03:12 PM
Hi,

I have a page with a dropdown and a radgrid with filtering on.  Depending on the selection on de dropdown another datatable is loaded in the radgrid. 

Problem I have now is when I have a datatable loaded and set a filter on and I change the selection in the dropdown to get another datatable the error 'neither a datacolumn nor a datarelation for table' occurs.

protected void grdEnquiry_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
{
    if (ddlEnquiry.SelectedValue != "-1")
    {
            BLogic.Enquiry Enquiry = new BLogic.Enquiry(Convert.ToInt16(ddlEnquiry.SelectedValue)); 
           grdEnquiry.DataSource = BLogic.Enquiries.Execute(Enquiry.System, Enquiry.Type, Enquiry.File);
    }
}

protected void ddlEnquiry_SelectedIndexChanged(object sender, EventArgs e)
{
    grdEnquiry.Rebind();
}

How can I fix this?

Kind regards

Suzy

1 Answer, 1 is accepted

Sort by
0
Viktor Tachev
Telerik team
answered on 18 Dec 2014, 10:01 AM
Hi Suzy,

The error you are seeing is usually observed when a DataField set in RadGrid cannot be found in the data source. Make sure that the DataField defined in every column of RadGrid is present in the data source. The same applies to the fields that are added to the DataKeyNames collection.

Regards,
Viktor Tachev
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Grid
Asked by
Suzy
Top achievements
Rank 2
Answers by
Viktor Tachev
Telerik team
Share this question
or