title: How can I pass string value for "asp-for" in asp net 5
body: <p>I want to write a Edit.cshtml file for an entity with many properties to edit, so I have to write the following codes many times:</p>
  
  <pre><code>&lt;div class="form-group"&gt;
      &lt;label asp-for="Email" class="col-md-2 control-label"&gt;&lt;/label&gt;
      &lt;div class="col-md-10"&gt;
          &lt;input asp-for="Email" class="form-control" /&gt;
          &lt;span asp-validation-for="Email" class="text-danger"&gt;&lt;/span&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Actually, there are many entities so that I have to write many Edit.cshtml files. I want to make some simplifications</p>
  
  <p>I want to select some properties of the entity in the controller and use loop to show the properties in the view. For example:
  In the controller file:</p>
  
  <pre><code>public IActionResult Edit(string id)
  {
      var model = GetModel(id);
      var propertyNames= new List&lt;string&gt;()
      {
          "Name",
          "Email"
          // add some other property names of the entity 
      };
      ViewData["PropertyList"] = propertyNames;
      return View(model);
  }
  </code></pre>
  
  <p>In the view file:</p>
  
  <pre><code>@{
      var propertyNames = (List&lt;string&gt;)ViewData["PropertyList"];
      foreach (string item in propertyNames)
      {
          &lt;div class="form-group"&gt;
              &lt;label asp-for="@(item)" class="col-md-2 control-label"&gt;&lt;/label&gt;
              &lt;div class="col-md-3"&gt;
                  &lt;input asp-for="@(item)" class="form-control" /&gt;
                  &lt;span asp-validation-for="@(item)" class="text-danger"&gt;&lt;/span&gt;
              &lt;/div&gt;          
          &lt;/div&gt;
      }
  }
  </code></pre>
  
  <p><strong>but it cannot work, since it generates wrong codes. It seems that I cannot pass a string value for "asp-for" tag helper.</strong></p>
  
  <p>For example, if I change the code of top to this:</p>
  
  <pre><code>@{
      string e = "Email";
      &lt;div class="form-group"&gt;
          &lt;label asp-for="@e" class="col-md-2 control-label"&gt;&lt;/label&gt;
          &lt;div class="col-md-10"&gt;
              &lt;input asp-for="@e" class="form-control" /&gt;
              &lt;span asp-validation-for="@e" class="text-danger"&gt;&lt;/span&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  }
  </code></pre>
  
  <p>The code above will generate this:</p>
  
  <pre><code>&lt;div class="form-group"&gt;
      &lt;label class="col-md-2 control-label" for="e"&gt;e&lt;/label&gt;
      &lt;div class="col-md-10"&gt;
          &lt;input class="form-control" type="text" id="e" name="e" value="Email" /&gt;
          &lt;span class="text-danger field-validation-valid" data-valmsg-for="e" data-valmsg-replace="true"&gt;&lt;/span&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>The expected code is:</p>
  
  <pre><code>&lt;div class="form-group"&gt;
      &lt;label class="col-md-2 control-label" for="Email"&gt;Email&lt;/label&gt;
      &lt;div class="col-md-10"&gt;
          &lt;input class="form-control" type="email" data-val="true" data-val-email="Email &amp;#x5B57;&amp;#x6BB5;&amp;#x4E0D;&amp;#x662F;&amp;#x6709;&amp;#x6548;&amp;#x7684;&amp;#x7535;&amp;#x5B50;&amp;#x90AE;&amp;#x4EF6;&amp;#x5730;&amp;#x5740;&amp;#x3002;" data-val-required="Email &amp;#x5B57;&amp;#x6BB5;&amp;#x662F;&amp;#x5FC5;&amp;#x9700;&amp;#x7684;&amp;#x3002;" id="Email" name="Email" value="" /&gt;
          &lt;span class="text-danger field-validation-valid" data-valmsg-for="Email" data-valmsg-replace="true"&gt;&lt;/span&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>How should I do?</p>
  
  <p>Is it possible in razor?</p>