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

CustomCommand - ColumnCommand Loop Through Objects

4 Answers 35 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
jfkrueger
Top achievements
Rank 1
jfkrueger asked on 24 May 2012, 08:47 PM
I am looking at the examples for the Grid under Custom Commands -> Column Command and am wondering how to implement a scenario where the details could contain a list of objects that need to be iterated through and displayed. For instance, a grid listing students that when you click the "Details" button it brings up the popup window to display the details about that student. One of the details would be courses they are enrolled in along with the grade for each course. There could be 0 or more courses and it is not known at design time. I already have the list of coures in my ViewModel that is being used but I don't know how to setup the HTML and javascript to use the collection. Any ideas?

Thanks!!

4 Answers, 1 is accepted

Sort by
0
Petur Subev
Telerik team
answered on 29 May 2012, 11:03 AM
Hi Joe,

I suggest you to use the approach shown in this online demo to configure the dependency between the Two Grids (sending the CustomerID via the OnDataBinding event of the child grid). Also you could replace the row selection and use template column with a button inside to show/hide a window which contains the child Grid. To do display the window (which should be initially hidden) you could use the open method provided by the client API of the Window inside the click handler of the button you have defined inside the template column.

Regards,
Petur Subev
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 Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now.
0
jfkrueger
Top achievements
Rank 1
answered on 04 Jun 2012, 02:01 PM
I will try that and post my results, thank you!
0
jfkrueger
Top achievements
Rank 1
answered on 21 Jun 2012, 09:23 PM
I should have read that a little better...

I don't have two grids (nor do I want two grids). When I click the details button in the grid I want a nice popup window in the center of the page to be displayed that show the details in a nice format, not a grid. Any other ideas?

Thanks again!
0
Petur Subev
Telerik team
answered on 26 Jun 2012, 11:40 AM
Hello Joe,

Well, once the button is clicked you can perform an Ajax request to the server and pass the studentID. Once you have the student courses on the server side you can return a partial view which displays them in the desired format. When request has completed you can display the content in the window.
Also you could check this demo which covers similar scenario with the use of custom command. It could be modified to use the suggestion above.

Kind regards,
Petur Subev
the Telerik team
Check out the successor of Telerik MVC Extensions - Kendo UI for ASP.NET MVC - and deem it for new ASP.NET MVC development.
Tags
Grid
Asked by
jfkrueger
Top achievements
Rank 1
Answers by
Petur Subev
Telerik team
jfkrueger
Top achievements
Rank 1
Share this question
or