Data annotations modelbinder in new mvc
Hi we are trying to upgrade our project to work in the latest version of VS 2010 and i have encountered a problem with the old Data Annotations Modelbinder.
Dim modelBinder = New DataAnnotationsModelBinder()
modelBinder.InvalidValueFormatter = _ Function(propDescriptor As PropertyDescriptor, value As String, displayName As String) _ String.Format("'{0}' är ej ett korrekt värde för {1}.", value, 开发者_如何学运维displayName)
ModelBinders.Binders.DefaultBinder = modelBinder
What Im trying to do is to overide the default errormessage for wrong datainput ("The value '{0}' is not valid for the {1} field.)
I try to get the default modelbinder to assign it a new errormessage
I found this post about this problem which solved my problem:
http://forums.asp.net/p/1512140/3606268.aspx#3606268
精彩评论