title: How to dynamically display a list of both name and value of a String/boolean pair on MVC in ASP.NET MVC
body: <p>I need to dynamically display a list of both name and value of string/boolean pair on MVC view (*.cshtml) based on user selection. Specifically, both name and value of a string and boolean pair are different in each list. There are more one list that user can select. For example: </p>
  
  <p>FruitName: Apple (string:string)</p>
  
  <p>IsRipen: true (string:boolean)</p>
  
  <p>BookName: C#</p>
  
  <p>IsSold: false</p>
  
  <p>One list type is defined as one report type. A list can be retrieved from report programmatically.</p>
  
  <p><strong>Possible Solution 1</strong>
  Since the data type of name and value in the list are fixed (string, boolean), one idea is to build a collection as a MVC model, and pass that model to MVC razor view. The question is that how to display the name on the view, </p>
  
  <pre><code>@Html.LabelFor(model =&gt; model.Names[0])  //how to display it as 'Fruit Name'
  </code></pre>
  
  <p><strong>Possible Solution 2</strong>
  In ASP.NET web form, there is user control whihch can be loaded dynamically. There is partial view in ASP.NET MVC. Can the partial view do what I want? Or is there better solution. </p>
  
  <p>I am new to MVC, any ideal or example would be very much appreicated.</p>