title: Asp.Net: Problem setting property value in UserControl
body: <p>I have a UserControl called 'Inspirations' with the following public property</p>
  
  <pre><code>private int pagenumber;
  public int PageNumber
  {
  
      get { return pagenumber; }
      set { pagenumber = value; }
  
  }
  </code></pre>
  
  <p>On my aspx page I set the value of the property like so:</p>
  
  <pre><code>Inspirations.PageNumber = (int)Convert.ToInt32(this.txtNum.Text);
  </code></pre>
  
  <p>On my aspx page I write back the value to check its been set:</p>
  
  <pre><code>Response.Write(Inspirations.PageNumber.ToString());
  </code></pre>
  
  <p>...and it has on my aspx page.</p>
  
  <p>However, I have a button on my UserControl to test the value of PageNumber and when I click that it always comes back as zero.</p>
  
  <pre><code>protected void btnAddCompany_Click(object sender, EventArgs e)
  {
      Response.Write(PageNumber.ToString());
  }
  </code></pre>
  
  <p>...the property value doesn't seem to have been passed back to my control.</p>
  
  <p>Can anyone tell me what I'm doing wrong, please.</p>
  
  <p>Regards
  Melt</p>