Who is online? 123 guests and 0 members
Member login | Become a member
home » blogs » vivek_iit » Javascript Popups Localization
posted 3/4/2008 by vivek_iit
We can localize Javascript pop up texts using server side variables in client side. In page class we will declare a protected variable:
public partial class _Default : BasePage { protected string jsPopUpText; protected void Page_Load(object sender, EventArgs e) { jsPopUpText= Resources.TestSiteResources.jsPopUp; }
Then we will use this value in the client side JS code as:
<script language="javascript"> alert('<%= jsPopUpText %>'); </script>
This will show us the localized text value from the RESX file based on the current thread's locale. For more info on localization in ASP.NET, refer this article:
http://www.codeproject.com/KB/aspnet/localizationByVivekTakur.aspx
vivek_iit (Member since: 11/27/2008) I am one of the administrators at CodeAsp.Net and I love programming, architecting solutions, code reviews, teaching and writing about ASP.NET.
View vivek_iit 's profile
Comment (No HTML)
It's fast, easy and free! Submit articles, get your own blog, ask questions & give answers in the forums, and become a better developer, faster.
enter your email address: