title: How do I pass a parameter to RazorPage OnGet()?
body: <p>Using <strong>razor pages</strong> I am trying to build an ecommerce website for selling clothing and I want to use once page as a template to load both mens and womens pages. To test this could be done in my <strong>_Layout.cshtml</strong> page I use <code>&lt;a asp-page="/Shop" asp-route-id="Mens" class="nav-link"&gt;Mens&lt;/a&gt;</code> and then in:</p>
  
  <h2>Shop.cshtml.cs</h2>
  
  <pre><code>    [BindProperties]
  public class ShopModel : PageModel
  {
      public string Status { get; set; }
      public void OnGet(string gender)
      {
          switch (gender)
          {
              case "Mens":
                  //get men page
                  Status = gender;
                  break;
              case "Womens":
                  //get womens page
                  break;
          }
      }
  }
  </code></pre>
  
  <h2>Shop.cshtml</h2>
  
  <pre><code>@page
  @model ECommerce.Pages.Shop.ShopModel
  @{
      ViewData["Title"] = "Shop";
  }
  &lt;p&gt;
      @Model.Status
  &lt;/p&gt;
  </code></pre>
  
  <p>When I debug the value of <strong>gender</strong> comes up as <strong>null</strong>, so status is never set. Am I going about this the wrong way? Any help is much appreciated, thanks!</p>