title: Passing Text Box Values from a user control file to another class file
body: <p>I am looking to pass values over from an ascx.cs user control file to another class file in my project. I need to be able to get the values of the dynamic text boxes from the user control to be able to put them in a database. </p>
  
  <p>Here is what I have so far</p>
  
  <p>User Control File</p>
  
  <pre><code>public void Page_Load(object sender, EventArgs e)
      {
          ItemBox.Text = Request.Form[ItemBox.UniqueID];
          NumberBox.Text = Request.Form[NumberBox.UniqueID];
          DescriptBox.Text = Request.Form[DescriptBox.UniqueID];
  
  
      }
  </code></pre>
  
  <p>Other class file </p>
  
  <pre><code> ViewState[VIEWSTATEKEY] = int.Parse(ViewState[VIEWSTATEKEY].ToString()) + 1;
          LoadPageControls();
          RowID ++;
  
          string box1value = Request.Form[ItemBox.Text];
          string box2value = Request.Form[NumberBox.UniqueID];
          string box3value = Request.Form[DescriptBox.UniqueID];
  
          string sConnection = generic database address;
  </code></pre>
  
  <p>I have seen other people using a get method to pull the data over. But I can't get the syntax right and it keeps giving errors.</p>
  
  <p>I tried this because I saw it here <a href="https://stackoverflow.com/questions/9626187/c-sharp-get-textbox-value-from-another-class">C# Get textBox value from another class</a> and thought it would work, but with no joy</p>
  
  <pre><code>string box1value{ get {return ItemBox.Text;} }
  </code></pre>
  
  <p>There is most likely something simple that I am missing here but I have been stuck on this problem for a couple off weeks now and it is driving me up the walls trying to get this project finished so any help that you can give would be much appreciated. </p>