Link to home
Start Free TrialLog in
Avatar of bmanmike39
bmanmike39

asked on

How do I move a JavaScript Variable to an asp.net code behind Variable (C#)

I have a java function that returns a value, in a var named Rm  I want to move that value to a ASP.NET variable named netRm.  Can someone show me how to do this.  Im using C#  in my code behind page.

Below is my code:


Aspx:
 
<label for="x1">x1:</label>
<script> var Rm = x1;</script>
<asp:Label ID=" Lblx1" runat="server" Text="Label"></asp:Label>
 
 
CodeBH:
 
String netRm;
Lblx1.text = netRm;

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Faizan Sarwar
Faizan Sarwar
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
once you have value in hidden field you can assign to your variable

public string Name;

        protected void btnTest_Click(object sender, EventArgs e)
        {
            Response.Write(hdnField.Value);
            Name = hdnField.Value;
        }

or in aspx

  <%=Name %>
Avatar of bmanmike39
bmanmike39

ASKER

Thanks!!!