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
Post a Comment