ASP.NET MVC (3) and CSLA Child collections

ASP.NET MVC (3) and CSLA Child collections

Old forum URL: forums.lhotka.net/forums/t/10057.aspx


djjlewis posted on Thursday, February 10, 2011

Although I have searched the forums and seen a number of posts on using MVC with CSLA (one of which was specifically on child collections!) none of them seem to answer the specific question around having an MVC View for an ER and an ECC.

In this scenario, let's say we have a Customer ER, with an ECC of Addresses. In our use-case we have to have the address collection displayed and edited on the same form as the main customer.

I am using the Telerik MVC controls, and would like to use their grid control for editing the Addresses ECC, which in turn can take a controller / action (either by Ajax or full Server post-back) for each crud operation.

At the moment I can see a couple of ways of doing this but would like to gather thoughts / feedback from anyone who has experience with this particular scenario:

1) Somehow add each entry to the grid client-side and process everything as part of the main form submission (would the model binder know how to handle the grid or would this need to be done manually?)

2) Make the grid call into an action method on the controller either via ajax or post-back for each child that is added / edited / deleted etc, but if this were the case, then I guess I'd have to either keep the whole ER in session or persist it to the db and retrieve it on each request in order to maintain the list of children?

as said, if anyone has any pointers on the best way to handle this scenario in MVC they would be gratefully received.

Regards,

Dan.

RockfordLhotka replied on Thursday, February 10, 2011

I am interested in insights people can provide as well.

The built-in support for collections provided by MVC is (imo) underwhelming. Do third-party controls like the Telerik one provide a better model for dealing with collections?

richardb replied on Friday, February 11, 2011

Using the Telerik MVC 3 grid here with Ajax and I'm afraid it's edit one row at a time currently - haven't figured out if its possible yet - certainly no examples around.  So we are pretty much doing option 2.  I did see a wish list request on the Telerik site asking for multi-row edit and batch submit, so maybe we'll get it down the road. 

Like the ideas of MVC but at the moment we lose that rapid UI development and cool controls.

Sorry, not much help there.



Curelom replied on Saturday, February 18, 2012

Dan,

How did you get a ER to bind Ajax with the Telerik MVC grid.  Whenever I try, I get a circular reference error.  It works if I change my ER to a ROR.

Don't have any help for your problem though.  Sorry.

Copyright (c) Marimer LLC