I want to get a codebehind value in my javascript function. My scenario is, Lets say I have two Usercontrols A and B.I am setting a global value from UserControl A. When I come to UserControl B's page load, I am accessing that value and putting it into a hidden field. I have a button on UserControl B which calls a javascript function on client click.On that function I am trying to catch the hiddenfields current value. But I always get 0 from the hidden field value. What I am doing wrong? Can someone help me?Below is the code:\[code\]<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="DetailsForm.ascx.vb" Inherits="TD_Web_App.DetailsForm" %><script type="text/javascript">function GetNextRecord() { debugger; var currentVal = $get("DetailsFormPanel_DetailsForm1_HFDetails").value; //clientID of my hidden field}</script><asp:UpdatePanel ID="DetailInfoUpdatePanel" runat="server" UpdateMode="Conditional" > <ContentTemplate><table id="TDPropsGrid" runat="server" width="250px" ></table> <asp:Button ID="Cmd_Next" runat="server" Text="Next" Width="100px" SkinID="ButtonSkin" UseSubmitBehavior="false" OnClientClick="GetNextRecord()"/><asp:LinkButton ID="LinkButtonDetails" runat="server" style="display:none;">LinkButton </asp:LinkButton></ContentTemplate></asp:UpdatePanel><asp:HiddenField ID="HFDetails" runat="server" />\[/code\]On code behind:\[code\] Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load showData() 'some function HFDetails.Value = http://stackoverflow.com/questions/12704560/CurrentRecordCounter' global value coming from other usercontrol End Sub'Private Sub Page_PreRender(sender As Object, e As System.EventArgs) Handles Me.PreRender' HFDetails.Value = http://stackoverflow.com/questions/12704560/CurrentRecordCounter'End Sub\[/code\]I have tried putting \[code\]<asp:HiddenField ID="HFDetails" runat="server" /> \[/code\]inside the update panel, nothing changed.But at GetNextRecord() the currentVal is always "0". why?