How to Change Default Validation Message Language of an ASP Application. NET MVC

Asked

Viewed 637 times

2

I have a model like this:

[Display(Name = "Protocolos Abertos")]
public int ProtocolosId { get; set; }

I use in a Selectlist like value, when I am going to do the Submit of a form the validation message is returned in different languages to localhost and to the homologation server.

- Test Server: Servidor de teste

- Localhost: Localhost

to web.config is configured:

<globalization culture="pt-BR" uiCulture="pt-BR" />

Is there any other configuration in the application to be performed to make this change from English to Portuguese?

OBS: I know it is possible to create customized error messages for the fields, but the default message is very useful.

  • This validation is that of the backend or frontend?

  • I believe it is in the frontend, because it does not even arrive at the method to treat the post.

  • Utilise @Html.DropDownListFor(model => model.ProtocolId, Model.ProtocolsList,"Selecione um protocolo", new { @id = "ProtocolId" }) when you are under "Select a protocol" there is no value in ProtocolId, what causes this message, because the same is the type int

1 answer

0


The solution I found to the problem was to install the language package corresponding to the desired language directly on the server. After that the validation messages started to appear in the correct language.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.