asp.net mvc - Localization of Required field validation message based on language selection from application in MVC -


i developing 1 mvc4 application, in there option language seletion in application & based on selected lanaguage, label & messages displayed.in application have put 1 required field validation of mvc, , display validation message in english only.i have created 2 different xml file localization in application folder i.e resource.resx english lanaguage & resource.de-de.resx german langauge. have used following code in model class :

    [required(errormessageresourcetype = (typeof(myfolder.myresource.resource)), errormessageresourcename= "fromdaterequiredmessage")]     [display(name = "fromdate", resourcetype = typeof(myfolder.myresource.resource))]     public datetime fromdate { get; set; } 

so here have resource.resx xml file , in have key 'fromdaterequiredmessage' same key in resource.de-de.resx german file different value.also have make follwing changes in in web.config file globalization :

<globalization enableclientbasedculture="true" culture="auto" uiculture="auto"/> 

so, want when select german language application, should show me validation error in german language.but here show me validation message in english only.

so, can this? please hel me.

please use method application_prerequesthandlerexecute() in application's global.asax file. method execute before page request or validation.

also set current culture value in method.


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -