title: Passing Javascript variable to C# function aspx and return from it to aspx page
body: <p>How can I pass the variable to c# function?.
  Suppose that:</p>
  
  <pre><code>&lt;script&gt;
  
      var myValue;
  
      function setValue(idriga) {
          myValue = idriga;
      }
  
      function getValue() {
          return myValue;
      }
  
  &lt;/script&gt;
  </code></pre>
  
  <p>This is a script that set and get value. How can i pass the <code>myValue</code> value to a c# function code behind without calling aspx page and passing parameters but passing from aspx to aspx.cs and the from aspx.cs to aspx to show value returned from c# method (example search value into db and return other value?)</p>
  
  <p>My function c# is:</p>
  
  <pre><code>protected string SearchUserByGuid(Guid area) {
      return (from us in contextDB.AREAS
              where us.ID_AREAS == area
              select us.USER_NAME).Single();
  }
  </code></pre>