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?
views:
597answers:
1
+5
A:
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
Charlino
2009-12-01 08:01:11
but when I checking ModelState.IsInvalid, it says true when the model object is incorrect state. TryUpdateModel also says OK
chester89
2009-12-01 08:41:38
I just followed through that tutorial just fine using ASP.NET MVC 2 Beta. I Suggest that you try it again with a new ASP.NET MVC 2 project but **DO NOT** follow the '**Using the Data Annotation Model Binder**' step. Instead, reference the following dll:'C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.5\System.ComponentModel.DataAnnotations.dll'And then start at the '**Using the Data Annotation Validator Attributes**' step.
Charlino
2009-12-01 10:42:34
thanks a lot, it works well. all I need to do was to reference a DataAnnotations dll. don`t know how I missed Phil`s post about default model binder in ASP.NET MVC 2
chester89
2009-12-01 11:49:31