MVC4 Binding an object which has a property of type BusinessListBase

MVC4 Binding an object which has a property of type BusinessListBase

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


dsburny posted on Friday, June 07, 2013

Hi

I have a viewmodel set up which is of type object1. Object1 has some properties, one of which is another object(object2) of type BusinessListBase. Currently when I submit my form using defaultModelBinder, object2 always has count = 0.

Is the only way to bind the list to use FormCollection as below from the using csla ebook:

public ActionResult EditList(FormCollection collection) { var list = RoleEditList.GetRoles(); UpdateModel(list, collection); SaveObject(list, false); return View(); }

If so, how does UpdateModel map the keys to the listitems, as the key does not exactly match, and it doesn't seem to do anything in my code?

Thanks

 

Copyright (c) Marimer LLC