title: How to pass complete Webcontrol?
body: <p>I need to pass a complete Webcontrol to a method with reference that will set value of that webcontrol by determining its type.</p>
  
  <pre><code>enter code here
  public void SetValue(ref WebControl,string value){
         Type t=WebControl.Gettype();
  
         if(t.Name== "TextBox"){
            // set TextBox Value
         }
        else if (t.Name=="Dropdown"){
        // set Dropdown value.
    }
  </code></pre>
  
  <p>}</p>
  
  <p>//////////////Calling of above function in aspx.cs file.</p>
  
  <pre><code>SetValue(ref txEmployee,"123");
  </code></pre>
  
  <p>I am using asp.net Webforms.</p>