title: Implementing Dropdownlist on Asp.net MVC 3 from viewModel
body: <p>I'm new to .net and mvc platform, i have so many int fields that stores some dropdownlist values, i've created fields int type due to database size so i'm implementing dropdownlist via this method, it works but i don't know if it's the correct solution to store text of values on viewmodel here is the sample code: </p>
  
  <p>i'm so sorry for my english, please let me know if you don't understand anything.</p>
  
  <p>model property.cs</p>
  
  <pre><code>    [Required(ErrorMessage = "Bu alan gereklidir!")]
      [Display(Name = "Şehir"), MaxLength(60)]
      public int City { get; set; }
  </code></pre>
  
  <p>propertymgmtviewModel</p>
  
  <pre><code> public Property Property { get; set; }
      public IEnumerable&lt;Property&gt; Properties { get; set; }
      public IEnumerable&lt;SelectListItem&gt; Cities
      {
          get
          {
              return new[]
              {
              new SelectListItem { Text="--Select One---", Value = "", Selected=true},
              new SelectListItem { Text="Chicago", Value = "1"},
              new SelectListItem { Text="New York", Value = "2"},
              new SelectListItem { Text="Zimbabwe", Value = "3"},
              };
          }
  </code></pre>
  
  <p>view for editing view page:</p>
  
  <pre><code> @Html.DropDownListFor(model =&gt; model.Property.City,
          new SelectList(Model.Cities,"Value","Text"))
  </code></pre>
  
  <p>displaying values viewpage : </p>
  
  <pre><code>   &lt;td&gt;
     @(item.City != null ?
     Model.Cities.SingleOrDefault(c =&gt; c.Value == item.City.ToString()).Text
     : "")
  
          &lt;/td&gt;
  </code></pre>