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

[Solved] Binding RadGrid to generic list

2 Answers 345 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Richard Branham
Top achievements
Rank 1
Richard Branham asked on 12 Mar 2010, 05:56 PM
I'm attempting to bind a generic list to a RadGrid.  This works:
            List<int> originList = new List<int>(); 
 
            originList.Add(24); 
            originList.Add(328); 
 
            myDataContext dc = new myDataContext(); 
            List<Leg_ListResult> legList = (from l in dc.Leg_List() 
//                                               where originList.Contains((int)l.OriginWaypointID) 
                                                select l).ToList(); 
            gridLegs.DataSource = legList; 

But the following does not.  The only difference is the addition of 'where' in the LINQ code.  When I run in the debugger, the legList contains the expected number of records in both cases, but no records are displayed in the grid in when I bind after specifying the where condition.  Am I missing something?

            List<int> originList = new List<int>(); 
 
            originList.Add(24); 
            originList.Add(328); 
 
            myDataContext dc = new myDataContext(); 
            List<Leg_ListResult> legList = (from l in dc.Leg_List() 
                                               where originList.Contains((int)l.OriginWaypointID) 
                                                select l).ToList(); 
            gridLegs.DataSource = legList; 

2 Answers, 1 is accepted

Sort by
0
Nikolay Rusev
Telerik team
answered on 15 Mar 2010, 09:46 AM
Hello Richard,

I don't see any reason why the code you use to not work as expected. For your convenience I've prepared sample application using scenario described in your post and it seems that RadGrid binds properly to the collection.

Please find the attached application.

All the best,
Nikolay
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Richard Branham
Top achievements
Rank 1
answered on 17 Mar 2010, 03:39 PM
Thanks for the reply. 

The problem was with the AJAX configuration, which I think I failed to mention in my initial post.  I configured the AJAX manager to update the grid in question and the page works as expected.
Tags
Grid
Asked by
Richard Branham
Top achievements
Rank 1
Answers by
Nikolay Rusev
Telerik team
Richard Branham
Top achievements
Rank 1
Share this question
or