Choose a location:
posted 3/4/2008 by Vivek Thakur
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
What kind of email newsletter would you prefer to receive from CodeAsp.Net? 18