title: Asp.net core How to bind data and get value of select TagHelper?
body: <p>Before everything look at my Model.</p>
  
  <p><strong>SystemPart Model</strong></p>
  
  <pre><code>public class systemPart
  {
     public int id { get; set; }
     public string systemName { get; set; }
     public int systemLevel { get; set; }
  }
  </code></pre>
  
  <p>I want to use this model in <code>Create</code> view. also In <code>create</code> view i want to have a <code>&lt;select&gt;</code> TagHelper from the same Model.</p>
  
  <p>Look at <code>Create</code> View</p>
  
  <pre><code>@model MyProject.Models.systemPart
  &lt;form asp-controller="SystemPart" asp-action="Create" method="post"&gt;
  
  
          &lt;div class="form-group"&gt;
              &lt;input asp-for="systemName" class="form-control" /&gt;
          &lt;/div&gt;
  
          &lt;div class="form-group"&gt;
              &lt;select asp-for="systemName" asp-items="@(new SelectList(ViewBag.SysList,"id","systemName"))"  class="form-control"&gt;&lt;/select&gt;
          &lt;/div&gt;
  
          &lt;div class="form-group"&gt;
              &lt;input type="submit" value="Create" class="btn btn-success" /&gt;
          &lt;/div&gt;
  
      &lt;/form&gt;
  </code></pre>
  
  <p>And in Controller I have :</p>
  
  <pre><code>   public class RoleController : Controller
     {
        private readonly ApplicationDbContext _context;
        public RoleController(ApplicationDbContext context)
        {
          _context = context;
        }
  
      [HttpGet]
      public IActionResult Create()
      {
          var sp = new List&lt;systemPart&gt;();
          sp = _context.sysPart_Tbl.ToList();
          ViewBag.SysList = sp;
          return View();
      }
  
      [HttpPost]
      public IActionResult Create(systemPart model)
      {
          if (ModelState.IsValid)
          {
              //
          }
          return View(model);
      }
     }
  </code></pre>
  
  <p>Now after lunch project <code>DropDownList</code> display info. But after select an option in <code>DropDownList</code> and submit form i cant get selected text and id.</p>
  
  <p>At <code>HttpPost</code> action method, I want the amount of the selected value (selected <code>id</code>) assign to <code>SystemLevel</code></p>