0

I have used resources file to create multi langual mvc3 application. In _viewStart.cshtml I have these two lines which makes it that loclization works for all views except partial views which is rendered from a ajax.form

System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo(AsoMvcApp.MySession.Current);
System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.CreateSpecificCulture(AsoMvcApp.MySession.Current);

when I check the CurrentUICulture for a partial view which is rendered from an action which is called from a ajax form it is still default and not chnaged. when I add those to lines of code in the begining of the partial views it works fine. but I don't want to add it to all partial views. it must be a better way.

4

1 回答 1

3

这一定是一个更好的方法。

是的,而不是将这段代码放在你_ViewStart.cshtmlApplication_AcquireRequestState方法中Global.asax

于 2013-05-11T17:21:03.983 回答