title: access TextBox And DropDownList Values from a class inside code behind
body: <p>i know i lack a base knowlage of the realtions between classes and inheritance </p>
  
  <p>i find it hard to understand a simple thing :</p>
  
  <p>a given <code>DDl</code> or <code>TextBox</code> could be accessed from code behind </p>
  
  <pre><code>int selected = DDLID.SelectedIndex ;
  
  string userInput = TBXID.Text;
  </code></pre>
  
  <p>Now from a class that is placed in code behind :</p>
  
  <pre><code>public static class ControlsValue
  {
     public static int UserSel = DDLID.Selected.index;
     public static string UserText = TBXID.Text;
  } 
  </code></pre>
  
  <p>i was trying to "Arange" my code so i will be able to reuse it in some other projects</p>
  
  <p>...so i have moved all global variables related to the code in that class into the class
  and what i can't do is assign variables with <code>webControls Values</code> </p>
  
  <p>what is the way to do it ? </p>
  
  <h2>update</h2>
  
  <p>a way i could think of is via parameter </p>
  
  <pre><code>public static class ControlsValue
  {
     public static void getValues(DropDownList DDLID)
     {
          public static int UserSel = DDLID.Selected.index;
     }
     public static string UserText(TextBox TBXID)
     {
        return TBXID.Text;
     }
  } 
  </code></pre>