asp.net - sharing same string constant in javascript and aspx file -


i want use string constant in javascript ans same string label in index.aspx. there way use same javascript constant in aspx?

declare public variable in (.cs) class file. (make const if dont want change it.) assign value wherever want to.

public string strname = "tester";  

& use in .aspx page :

<label> <%: strname %>  </label>  <script type="text/javascript">      var x = '<%: strname %>';  </script> 

Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -