title: Get Selected Value of html dropdown in razor page dotnet
body: <p>With the below code how can I get the value of the dropdown list using page handlers or tag helpers?</p>
  
  <p>One way I've been reading is using OnChange on the dropdown, I can set the value of a hidden field with javascript then get value of hidden field from code behind. Should I even be using page handlers/tag helpers to get the dropdown value?</p>
  
  <p>I have tried using <code>Request.Form["networks"]</code> but this just gives the ID and not the Value.</p>
  
  <pre><code>&lt;form method="post"&gt;
       @Html.DropDownList("networks",
       Model.GetNetworks().Select(s =&gt; new SelectListItem()
       {
           Text = s.networks,
           Value = s.id.ToString(),
       }),
       new
       {
          @class = "dropdown form-control",
       })
       &lt;input type="hidden" id="selectedwifivalue" /&gt;
       &lt;br /&gt;
       &lt;input type="text" placeholder="enter wifi password" asp-for="Password" class="input-sm form-control" /&gt;
       &lt;br /&gt;           
       &lt;button asp-page-handler="submit" class="btn btn-primary btn-sm form-control"&gt;Submit&lt;/button&gt;
  &lt;/form&gt;
  </code></pre>
  
  <h2>Model is</h2>
  
  <pre><code>public class WifiNetworks
  {   
      public int id { get; set; }
      public string networks { get; set; }
      public IEnumerable&lt;SelectListItem&gt; UserNetworks { get; set; }
  }
  </code></pre>
  
  <h2>Code behind in cshtml file</h2>
  
  <pre><code>[BindProperty]
  public string Password { get; set; }
  public string networks { get; set; }
  public void OnPostSubmit()
  {
      {
          var password = Request.Form["password"];
          var network = Request.Form["networks"]; &lt;--this just gives the ID and not the value
          var wifi = networks;  &lt;---this is blank
      }
  }
  </code></pre>