Wednesday, February 8, 2012

how to Passing a server side variable into javascript

Recently I have seen a server side code which is used to pass the server side value to javascript.So whenever we will transfer the server side value to Javascript we don't need to write server side .For this here i will show a simple way to pass the variable to javascript from server side
<input id="hidCtrl" type="hidden"  runat="server" value='<%# ServerVaribaleValue %>'/>
Here the server side value which is"ServerVaribaleValue" is assigned as a hidden field value.The below javascript will get the value of hidden field
<script language="javascript">
function onclick(){

Post a Comment