title: SetValue in reflection returning object does not match target type
body: <p>I am looping through a class with multiple properties and am searching for any textboxes that have the same ID. If there is a match then I want to update the property value to that of the textbox value, but I am getting this error: </p>
  
  <blockquote>
    <p>Object does not match target type</p>
  </blockquote>
  
  <p>This is the code:</p>
  
  <pre><code>foreach (var prop in contactInfo.GetType().GetProperties())                    
  {                        
      var ctrl = WizardCampaign.FindControl(prop.Name) ?? Page.Master.FindControl(prop.Name);        
  
      if (ctrl != null)
      {
          if (ctrl.GetType() == typeof(TextBox))
          {
              var r = (TextBox)ctrl;                                                                                                                                                                                             
              prop.SetValue(prop, r.Text, null);                                
          }
      }
  }
  </code></pre>