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

Best practice for DropDownList inside a Grid

1 Answer 38 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Michele
Top achievements
Rank 2
Michele asked on 28 Aug 2013, 03:51 AM
Hello,
please excuse me if I post you this but I was wondering what's the best approach for implementing this...
I've got a Grid witch has 3 column that will be editable and will have to show a dropdown while editing... we can call them Country,Profile and Status
I've to prefix that I came from SL world so what I do in that world would be
  • call the services GetCountries,GetProfiles and GetStatus
  • save those datas in 3 different collection
  • at the cell edit open the dropdown loading the corresponding collection as possible values and selecting the selected matching the IdCountry,IdProfile.IdStatus

How can I do this in the MVC world? I think I can't have all done via Mvc without using javascript... or should I create a viewmodel that holds those collections?

If I use "pure" js I would have 3 calls to the service from js, store the values and perform as I've written above

Any suggestion?
Thanks

1 Answer, 1 is accepted

Sort by
0
Petur Subev
Telerik team
answered on 29 Aug 2013, 04:17 PM
Hello Paolo,

When using the MVC Wrapper of the Grid widget you can go smoothly and use the ForeignKey column feature. You will only need to pass those three collections from the controller to the view where you can pass them to the Grid

Check the following demo (there is code for Razor as well) (same should be implemented for all three columns). You should not face any difficulties since from your explanation it does not sound that the collections depend on each other (no cascading).

I hope this helps.

Kind Regards,
Petur Subev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Grid
Asked by
Michele
Top achievements
Rank 2
Answers by
Petur Subev
Telerik team
Share this question
or