Validationengine jquery not working properly for localization

醉酒当歌 提交于 2020-01-21 22:19:06

问题


I am using validationEngine jquery 2.6.2 for validation in ASP.NET. I want to load its language rules file according to the language selected like English or Japanese. I am using master page in the application. Give some solution for this.


回答1:


You didn't specify how the language are selected and how you are going to check the current selected language.

To localize validationEngine, you must reference the right script language.

If you use a Script Manager, in the code behind of your Master Page you can reference dinamically the localization script.

The Script Manager markup declaration:

<asp:ScriptManager ID="scrManager" runat="server">
  <Scripts>
    <asp:ScriptReference Path="~/js/jquery.validationEngine.js" />
  </Scripts>
</asp:ScriptManager> 

Then you can add dynamically your language script (code behind):

ScriptReference validationEngineLanguage = new ScriptReference();
// #### Assign the correct script reference based on the selected language #####
validationEngineLanguage.Path = "~/js/jquery.validationEngine-en.js";
this.scrManager.Scripts.Add(validationEngineLanguage);

Another option to dinamically reference the script would be get the tag reference in codebehind and add the script tag.



来源:https://stackoverflow.com/questions/14524881/validationengine-jquery-not-working-properly-for-localization

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!