Let see an example to pass a value from javascript from one page to another page:
1. In the first aspx page, say Page1.aspx, add:
<asp:HiddenField ID="HiddenField1" runat="server" />
<asp:Button ID="Button1" runat="server" OnClientClick="passValue2CodeBehind();" Text="Button" onclick="Button1_Click" />
2. In the code behind of the first aspx page, register a javascript in the Page_Load event:
ClientScript.RegisterStartupScript(this.GetType(), "myscript", "<script language='javascript'>function passValue2CodeBehind() { var lat='1.2345'; document.getElementById('HiddenField1').value = lat; } </script>");
3. Add this line to the Button1_Click in the code behind:
Response.Redirect("~/Page2.aspx?lat=" + HiddenField1.Value);
4. Create the Page2.aspx and add a label:
<asp:Label ID="Label1" runat="server"></asp:Label>
5. In the Page_Load event of the code behind of Page2.aspx, add this:
Label1.Text = this.Request.QueryString["lat"];
Now, launch Page1.aspx to see the working.