title: Dynamically binding input-text to class/object propertys using Blazor
body: <p>Im trying to build a dynamic list of input field for properties inside a class using Blazor but cant figur out how to bind/link the content of a input box to a property of a class. <em>(the class have can have a large number of public props, not only Name and Description as in the below example, they are not always of the type "string")</em></p>
  
  <p>lets say that I have this class/model:</p>
  
  <pre><code>public class customer{
          public string Name { get; set; }
          public int Age { get; set; }
          public string Description { get; set; }
  
  }
  </code></pre>
  
  <p>I got this blazor component (<strong><em>updateC.razor</em></strong>):</p>
  
  <pre><code>@inherits CLogic    
  @if (nfo != null)
  {
        @foreach (var obj in nfo)
        {
               &lt;input type="text" class="form-control"      
               bind=@SCustomer.GetType().GetProperty(obj.ToString())/&gt;
        }
  }
  </code></pre>
  
  <p>and finally Clogic:</p>
  
  <pre><code>public class Clogic: ComponentBase{
      [Parameter]
      public Customer SCustomer { get; set; } = new Customer();
      [Parameter]
      public PropertyInfo[] nfo { get; set; }
  
      protected override void OnAfterRender(bool firstRender)
      {
          if (firstRender)
          {
              nfo = SCustomer.GetType().GetProperties();
              StateHasChanged();
          }
      }
  }
  </code></pre>
  
  <p>This is suppose to bind changes made in each input field to the correct property in the current instance of SCustomer <em>(when input is made it is suppose to update the correct property of the class/object)</em>. This is not working, values inside of SCustomer are not changed after input are done. I'm guessing that i'm going about this completely wrong but can't seem to figure out how to make this work and can't find any examples doing this. </p>