title: How to get name value from SelectList in mvc
body: <p>I want to get the name value not ID value from SelectList in mvc.</p>
  
  <p>Here is my code</p>
  
  <p>Controller</p>
  
  <pre><code>var occupationList = new SelectList(new[] 
  {
      new { ID = 1, Name = "Student" },
      new { ID = 2, Name = "House Wife" },
      new { ID = 3, Name = "Business Man" },
      new { ID = 4, Name = "Service Man" },
  },
  "ID", "Name", 1);
  ViewData["occupationList"] = occupationList;
  return View();
  </code></pre>
  
  <p>View</p>
  
  <pre><code>@Html.DropDownList("Occupation", ViewData["occupationList"] as SelectList, new {@class="control-label", style="width:250px;" })
  </code></pre>
  
  <p>Now, when I select the item from dropdownlist at that time it shows the selected item but it store the ID value in the database.</p>
  
  <p>For ex : I select the <code>Student</code> Name value from the dropdownlist and save it. Now, in database it store the <code>1</code> value.</p>
  
  <p>But I dont want to store the ID value i.e. <code>1</code>. I want to store the Name value i.e. <code>Student</code> in database.</p>
  
  <p>Thank You.</p>