title: Getting a viewstate error on button click on Aspx page?
body: <p>I have a web page in <strong>Asp.Net</strong> and a button on it</p>
  
  <pre><code>&lt;asp:Button ID="btnRecordHours" runat="server" Text="&lt;%$ Resources:VolunteerDashboard,btnRecordHours%&gt;"
  CssClass="buttonGreen buttonWidth" OnClick="btnRecordHours_Click" /&gt;
  </code></pre>
  
  <p>With this on its <code>OnClick</code> event i have attached a method named <code>btnRecordHours_Click</code></p>
  
  <pre><code>protected void btnRecordHours_Click(object sender, EventArgs e)
  {
       //Some Code
  }
  </code></pre>
  
  <p>But when i am clicking this button i am getting following error: </p>
  
  <blockquote>
    <p>Failed to load viewstate.<br>
    The control tree into which viewstate is 
    being loaded must match the control tree 
    that was used to save viewstate during the previous request. 
    For example, when adding controls dynamically, the controls added during a post-back must match the type and position of the controls added during the initial request.</p>
  </blockquote>
  
  <p>It is not even able to hit the <code>Click</code> event on post back directly showing this error <code>OnClick</code>.</p>
  
  <p><code>Hyperlink</code> and some other button are working fine on this page but this issue persist for some of the button.</p>