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

Fitlering/Sorting List of Object Column?

1 Answer 92 Views
Grid
This is a migrated thread and some comments may be shown as answers.
<><
Top achievements
Rank 1
<>< asked on 01 Jun 2011, 03:28 PM
Hey,

I have a Linq to Sql data object which has 2 classes called Topics & Posts.  Each topic can have multiple posts, thus, there is a one to many relationship from topic to posts.

I have the RadGrid bound to a LinqDataSource object which returns all topics, and topics can access all posts under that topic, ie topics(x).posts(y).subject etc.

In the RadGrid, for testing purposes, I am binding the first post as the subject of the topic, for example:

<telerik:GridBoundColumn DataField="posts(0).post_subject" DataType="System.String" 
    FilterControlAltText="Filter column" HeaderText="post_subject" 
    UniqueName="post_subject" SortExpression="posts.post_subject">
</telerik:GridBoundColumn>

This works fine, and displays the information in the grid correctly, but, if I do any type of sorting/filtering I get the following error:

Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerServerErrorException: No property or field 'post_subject' exists in type 'EntitySet`1'

I've tried different variations of the SortExpression but still get a similar error.

Is there a way to achieve this?

Thanks

1 Answer, 1 is accepted

Sort by
0
Iana Tsolova
Telerik team
answered on 06 Jun 2011, 09:50 AM
Hi,

To overcome the issue, you can create a new class which has the post_subject exposed as a public property instead of using the nested properties.
Additionally, check the below article for more information:
http://www.telerik.com/help/aspnet-ajax/grid-tips-when-binding-to-custom-collections.html

All the best,
Iana
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Tags
Grid
Asked by
&lt;&gt;&lt;
Top achievements
Rank 1
Answers by
Iana Tsolova
Telerik team
Share this question
or