-
as seen on Stack Overflow
- Search for 'Stack Overflow'
Hi,
I've a scenario where I need to bind to an interface - in order to create the correct type, I've got a custom model binder that knows how to create the correct concrete type (which can differ).
However, the type created never has the fields correctly filled in. I know I'm missing something blindingly…
>>> More
-
as seen on Stack Overflow
- Search for 'Stack Overflow'
Hi,
I've a scenario where I need to bind to an interface - in order to create the correct type, I've got a custom model binder that knows how to create the correct concrete type (which can differ).
However, the type created never has the fields correctly filled in. I know I'm missing something blindingly…
>>> More
-
as seen on Stack Overflow
- Search for 'Stack Overflow'
(My apologies if this seems verbose - trying to provide all relevant code)
I've just upgraded to VS2010, and am now having trouble trying to get a new CustomModelBinder working.
In MVC1 I would have written something like
public class AwardModelBinder: DefaultModelBinder
{
:
public override…
>>> More
-
as seen on Stack Overflow
- Search for 'Stack Overflow'
This is my custom model binder. I have my breakpoint set at BindModel but does not get fired with this controller action:
public ActionResult Create(TabGroup tabGroup)
...
public class BaseContentObjectCommonPropertiesBinder : DefaultModelBinder
{
public new object BindModel(ControllerContext…
>>> More
-
as seen on Programmers
- Search for 'Programmers'
It occurs to me that the ModelBinder mechanism in ASP MVC
public interface IModelBinder {
object BindModel(System.Web.Mvc.ControllerContext controllerContext, System.Web.Mvc.ModelBindingContext bindingContext);
}
Is insanely powerful. What are some cool uses of this mechanism that you've done/seen…
>>> More