Problem with DataAnnotationsModelBinder in ASP.NET MVC 2
-
22-07-2019 - |
Question
Everybody tried out a tutorial on DataAnnotations from mvc official website? It didn't work for me.
When I'm trying to submit edited product, I have this error message:
Method not found: 'System.Collections.Generic.IDictionary`2 System.Web.Mvc.ModelBindingContext.get_ValueProvider()'.
I'm using ASP.NET MVC 2 preview 2. Any ideas why this happening? I registered model binder which they required.
May be someone came across a post or article that had a guide how to get this to work?
Solution
The DataAnnotations model binder is the default model binder in ASP.NET MVC 2, you shouldn't have to register the model binder as it does in the tutorial. So remove the line where you register the model binder.
Also, while you're at it, you should probably update to the ASP.NET MVC 2 Beta.
HTHs,
Charles