Read Resource File values in Javascript

Niladri.Biswas
Posted by Niladri.Biswas under JavaScript category on | Points: 40 | Views : 11774
First create a resource file call "Test". Enter the Name as "TestValue" and the Value as "Some Test Value". Next use the below code

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script language="javascript" type="text/javascript">
function Test() {

var value = '<% = Resources.Test.TestValue%>';
alert(value);

}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Button ID="Button1" runat="server" Text="Button" OnClientClick="Test()" />
</div>
</form>
</body>
</html>

Comments or Responses

Login to post response