views:

33

answers:

1

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

+1  A: 

I found this post about this problem which solved my problem:

http://forums.asp.net/p/1512140/3606268.aspx#3606268

Erik Forsmyr
then you should mark this answer as "correct" to avoid confusion.
Yngve B. Nilsen