title: Verify Checkbox.Checked from static method
body: <p>I'm developing a web page for clients to request exemptions from certain requirements.  There is a list of 14 CheckBoxes, each with two subsequent Checkboxes.  The code to check which of them are checked will be placed in the submit button.  This method is in the code behind.  Here's the code for that (so far)</p>
  
  <pre><code>[WebMethod]
  public void SendForm(string email)
  {
      if (string.IsNullOrEmpty(email))
      {
          throw new Exception("You must supply an email address.");
      }
      else
      {
          if (IsValidEmailAddress(email))
          {
              bool[] desc = new bool[14];
              bool[] local = new bool[14];
              bool[] other = new bool[14];
  
              for (int i = 1; i &lt;= 14; i++)
              {
                  desc[i] = ((CheckBox)Page.FindControl("chkDesc" + i.ToString())).Checked;
                  local[i] = ((CheckBox)Page.FindControl("chkLocal" + i.ToString())).Checked;
                  other[i] = ((CheckBox)Page.FindControl("chkOther" + i.ToString())).Checked;
  
                  /* Do stuff here */
              }
          }
          else
          {
              throw new Exception("You must supply a valid email address.");
          }
      }
  }
  </code></pre>
  
  <p>I get the error "An object reference iw required for the non-static field, method, or property..." </p>
  
  <p>In the aspx page I have the button and the javascript/ajax that calls the button in the codebehind.  Shown here: </p>
  
  <pre><code>&lt;table width='750' align='center'&gt;
      &lt;tr&gt;
          &lt;td align='left'&gt;
              &lt;label&gt;Please Provide your email address:&lt;/label&gt;
              &lt;asp:TextBox ID="txtEmail" runat="server"&gt;&lt;/asp:TextBox&gt;
          &lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td align='left'&gt;
              &amp;nbsp;
          &lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td align='left'&gt;
              &lt;fieldset id="Fieldset"&gt;
                  &lt;button onclick="SendForm();"&gt;
                      Send&lt;/button&gt;               
                  &amp;nbsp;
                  &lt;button onclick="CancelForm();"&gt;
                      Cancel&lt;/button&gt;                  
              &lt;/fieldset&gt;
          &lt;/td&gt;
      &lt;/tr&gt;
  &lt;/table&gt;
  &lt;/form&gt;
  
  &lt;asp:ScriptManager ID="ScriptManager1" EnablePageMethods="true" EnablePartialRendering="true" runat="server" /&gt;
  
  &lt;script type="text/javascript"&gt;
      function SendForm() {
          var email = $get("txtEmail").value;
  
          PageMethods.SendForm(email, OnSucceeded, OnFailed);
      }
  
      function OnSucceeded() {
          $get("Fieldset").innerHTML = "&lt;p&gt;Thank you!&lt;/p&gt;";
      }
  
      function OnFailed(error) {
          alert(error.get_message());
      }
  &lt;/script&gt;
  </code></pre>