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

How to bind nested collection

4 Answers 49 Views
Grid
This is a migrated thread and some comments may be shown as answers.
ali zubair
Top achievements
Rank 1
ali zubair asked on 07 Jun 2010, 07:39 AM
Hi All,

I have struck with very serious problem while using Rad grid.

Issue is my web Method returns a collection (Student Collection). i have bounded that collection to rad grid through javascript like

IndendedProgramGrid = $find("<%= rgIndendedProgram.ClientID %>").get_masterTableView();
IndendedProgramGrid.set_dataSource(result[0].ObjStudentProgramsCollection);
IndendedProgramGrid.dataBind();

In "ObjStudentProgramsCollection" have some direct colums like "ID" which is bounded very successfully with grid.But this collection also have another collection in it. Like "ObjStudentProgramsCollection[0].Cources.CoucseName". Now i want to bind course name to rad grid colum..

How can i bind this.
In asp data list i simply use following code and works properly. How can i do this in Rad Grid>????
 <%#Eval("Courses.courseName")%>

Please help.......


4 Answers, 1 is accepted

Sort by
0
ali zubair
Top achievements
Rank 1
answered on 07 Jun 2010, 10:36 AM
Any help pleaseeeeeeeeeeeeeeeee.....

If there is any problem regarding question understanding then please let me know. thanks
0
Accepted
Nikolay Rusev
Telerik team
answered on 07 Jun 2010, 12:09 PM
Hello Ali,

RadGrid cannot bind out of the box to nested properties. However you can  handler OnRowDataBound client event and populate the cell manually as demonstrated on the snippet bellow:
1.function rowDataBound(sender, args)
2.            {
3.                args.get_item().get_cell("Column_UniqueName").innerHTML = args.get_dataItem().Nested.Text;
4.            }


Best wishes,
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
ali zubair
Top achievements
Rank 1
answered on 07 Jun 2010, 03:21 PM
Thanks for reply..

But i am confused what is args.get_dataItem().Nested.Text; statement do. Espacially Nested. can you please explain.??
0
ali zubair
Top achievements
Rank 1
answered on 07 Jun 2010, 03:48 PM
ok..ok.. i got it. thanks and it is working.. Thanks a lot.
Tags
Grid
Asked by
ali zubair
Top achievements
Rank 1
Answers by
ali zubair
Top achievements
Rank 1
Nikolay Rusev
Telerik team
Share this question
or