title: Create dynamic fields in asp.net mvc
body: <p>I have table <code>user</code> with fields in additional custom fields for user that added by admin.
  <a href="https://i.stack.imgur.com/XYj1l.jpg" rel="nofollow noreferrer">sql click this to diagram explain this</a></p>
  
  <p>so i want to create <code>Register</code> page with user fields and custom fields.
  i get <code>FiledType</code> and <code>FieldName</code> to list.
  in Controler:</p>
  
  <pre><code>public ActionResult Index()
      {
          ViewBag.CustomeFields = userCustomeFields.GetCustomeField();
          return View();
      }
  </code></pre>
  
  <p>UserField model:</p>
  
  <pre><code>public class UserField
  {
      public string FieldName;
      public string FieldTypeName;
  }
  </code></pre>
  
  <p>so i want to create dynamic fields in cshtml file.
  i wrote this code:
  <strong>Update:</strong></p>
  
  <pre><code> @foreach (var item in ViewBag.CustomeFields)
      {
          &lt;div class="form-group"&gt;
              @*@Html.LabelFor(i=&gt;item.FieldTypeName  , htmlAttributes: new { @class = "control-label col-md-2" })*@
              &lt;div class="col-md-10"&gt;
                  @if (item.FieldTypeName == "Textbox")
                  {
                      @Html.TextBox(item.FieldName)
                  }
                  &lt;/div&gt;
              &lt;/div&gt;
                      @*@Html.Editor(item.FieldName, new { htmlAttributes = new { @class = "form-control" } })*@
                      }
  </code></pre>
  
  <p>but i give error!
  <code>HtmlHelper&lt;User&gt;' has no applicable method named 'TextBox' but appears to have an extension method by that name. Extension methods cannot be dynamically dispatched. Consider casting the dynamic arguments or calling the extension method without the extension method syntax.</code>
  i don't know is my way correct or not?!</p>