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

Filtering Grid On Entity Associations

2 Answers 63 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Richard Weeks
Top achievements
Rank 2
Richard Weeks asked on 01 Dec 2011, 02:13 AM
If I have a RadGrid set up declaratively using an EntityDataSource, how can I set up filtering to cater for entity associations?

For example, in the EntityDataSource, this will not work if I try to filter on "Model":

Select="it.[Id], it.[ModelId], it.[Model].[Name] AS Model"

This results in an error:

Error: Sys.WebForms.PageRequestManagerServerErrorException: LIKE arguments must be of string type. Near member access expression, line 8, column 4.

The auto-generated column (by selecting Refresh Schema in the design view of the EntityDataSource control) is as follows:
<telerik:GridBoundColumn
    DataField="Model"
    DataType="System.String"
    FilterControlAltText="Filter Model column"
    HeaderText="Model"
    ReadOnly="True"
    SortExpression="Model"
    UniqueName="Model">
</telerik:GridBoundColumn>

Richard

2 Answers, 1 is accepted

Sort by
0
Accepted
Radoslav
Telerik team
answered on 05 Dec 2011, 11:52 AM
Hi Richard,

Unfortunately such a scenario is not supported by the RadGrid control - what you need to do is to flatten your custom object into another one that will have only single object properties.

Regards,
Radoslav
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
0
Richard Weeks
Top achievements
Rank 2
answered on 05 Dec 2011, 11:27 PM
Luckily, I only needed a read-only representation of the data, so I was able to construct and query a view.

This worked very well indeed.

Richard
Tags
Grid
Asked by
Richard Weeks
Top achievements
Rank 2
Answers by
Radoslav
Telerik team
Richard Weeks
Top achievements
Rank 2
Share this question
or