Closed rontran closed 8 years ago
@rontran we probably need a small GitHub repo. It's likely the problem is either a detail that's important in your case or something from #4703 you didn't implement.
I've uploaded my POC at https://github.com/rontran/ModelBinding
Thanks!
The repro project contained a number of bugs. I opened rontran/ModelBinding#1 with a few fixes. I'll also check #4703 to see if any recommendations are misleading.
I didn't see "Cannot create an instance of an interface." errors but the model binder provider would overflow the stack.
@rontran please close this issue if I've answered your questions.
It works. I had problem compiling your changes but after updating to update 3, it works. Thanks alot!
So I have a viewmodels
Basically I have a survey with many controls that can be a section(with many controls), question, a label, a button etc. I am using a displaytemplate to loop through the collections. It works but however when I postback, I, of course, get the "Cannot create an instance of an interface.". How do I intercept the modal binding. In old version, we had
CreateModel
so I can return aList<IControl>
or the right object based on a hidden input.I used the answer provided in https://github.com/aspnet/Mvc/issues/4703 and I still get the same error.