title: Calling a code behind method based on a click event
body: <p>I currently have this working but it requires me to have a static method as the method called in the code behind.  I would like to be able to access some member variables that can't be static.  I'm not married to the Javascript implementation and am open to other suggestions that would help me achieve this.</p>
  
  <p>If there is other information that would be helpful let me know and I can include.</p>
  
  <p>EDIT: Let me clarify, I'm looking to edit a value in one of the user controls on the page based on the button click.  I am holding the user controls in a list on the page and using the parameters passed through the javascript to find the user control that I want to update and modify the value there.</p>
  
  <p>It currently looks like this: </p>
  
  <p>Javascript: </p>
  
  <pre><code>    function incrementCompletes(obj) 
      {
          var firstParameter = $(obj).parents('.parentClass1').find('.childClass1').html();
          var secondParameter = $(obj).parents('.parentClass2').find('.childClass2').html();
  
          var parameters = "{'firstParam':'" + firstParameter+ "','secondParam':'" + secondParameter+ "'}";
           $.ajax({
              type: "POST",
              url: "Page.aspx/StaticMethod",
              contentType: "application/json; charset=utf-8",
              data: parameters,
              dataType: "json",
              success: 
              function DoOtherStuffHere(result) {
                  var x = $(obj).parents('.classWithStuffToChange');
                  var y = $(x).find('.otherClassWithStuffToChange');
                  y[0].innerHTML=" + " + result.d;
              }
          });
      }
  </code></pre>
  
  <p>Code behind:</p>
  
  <pre><code>    [WebMethod]
      public static int StaticMethod(string parameter1, string parameter2)
      {
          //Do some stuff
          //Return a value
      }  
  </code></pre>
  
  <p>I would like to find a solution that does not require the method called to be static.</p>