title: Asp mvc display text value from id field in a SelectList
body: <p>how do I display the text value(CountryName) from the selected id (CountryId) in a SelectList? The SelectList is contained in a view model sent to Details view template. The field is currently displaying CountryID. I want CountryName.</p>
  
  <p>view</p>
  
  <pre><code>&lt;div class="display-field"&gt;@Model.Dinner.CountryID&lt;/div&gt;
  </code></pre>
  
  <p>controller</p>
  
  <pre><code>public ActionResult Details(int id)
      {
          Dinner dinner = dinnerRepository.GetDinner(id);
          DinnerFormViewModel model = new DinnerFormViewModel(dinner);
          if (dinner == null)   
              return View("NotFound");       
          else           
              return View("Details", model);
      }
  </code></pre>
  
  <p>viewmodel</p>
  
  <pre><code>public class DinnerFormViewModel
  {
      public Dinner Dinner { get; private set; }
      public SelectList CountriesList { get; private set; }
  
      public DinnerFormViewModel(Dinner dinner)
      {
          Dinner = dinner;
  
          var items = new List&lt;Country&gt;() {
                  new Country() { 
                      CountryID = 1,
                      CountryName = "England"
                  },
                  new Country() { 
                      CountryID = 2,
                      CountryName = "Ireland"
                  },
                  new Country() { 
                      CountryID = 3,
                      CountryName = "Scotland"
                  },
                  new Country() { 
                      CountryID = 3,
                      CountryName = "Wales"
                  }
              };
  
          CountriesList = new SelectList(items, "CountryID", "CountryName", 2);
      }
  }
  </code></pre>
  
  <p>Again this is just to display the CountryName value in a label. Dont want to edit it or anything. LINQ expression?</p>