how to set asp.net hidden field in javascript and access the value in c# code behind -


i'm trying set hidden field value in js think works fine approachl

  <asp:hiddenfield id="hflatsw" runat="server" />     var latsw = bounds.getsouthwest().lat();    $('#<%=hflatsw.clientid %>').value = latsw; 

trying access value on asp.net button click in code behind gives me null value, idea happening in postback , why i'm not able access value set javascript? in advance, laziale

.value isn't jquery property. use .val():

$('#<%=hflatsw.clientid %>').val(latsw); 

or without jquery:

document.getelementbyid('<%=hflatsw.clientid %>').value = latsw; 

Comments

Popular posts from this blog

PHPMotion implementation - URL based videos (Hosted on separate location) -

javascript - Using Windows Media Player as video fallback for video tag -

c# - Unity IoC Lifetime per HttpRequest for UserStore -