title: How do I select the selected item (Id) in the dropdown in a Razor-component?
body: <p>I have a Razor page with a child-Razor-component with a dropdown, with selected items.</p>
  <p>But how do I select the selected item in the dropdown?</p>
  <p>The Razor Childcomponent:</p>
  <pre><code>&lt;div class=&quot;col-4 selection&quot;&gt;
      &lt;select id=&quot;selecteerPeriode&quot; @onchange=&quot;@(() =&gt; OnChange.InvokeAsync(@item.Id))&quot; class=&quot;form-control&quot;&gt;
          @*&lt;select  class=&quot;form-control&quot;&gt;*@
              &lt;option value=&quot;&quot;&gt;-- Select period --&lt;/option&gt;
          @foreach (var item in Model.Index)
          {
              string display = $&quot;{@item.Year} week {@item.Week}&quot;;
              &lt;option value=&quot;@item.Id&quot;&gt;@item.Description&lt;/option&gt;
          }
      &lt;/select&gt;
  &lt;/div&gt;
  </code></pre>
  <p>In the Razor-page:</p>
  <pre><code>&lt;TopListSelect Model=@selectModel ListName=&quot;toplist&quot; OnClick=&quot;ClickHandler&quot; OnChange=&quot;SetSelectedPeriod&quot; /&gt;
  </code></pre>
  <p>...and: (The message needs the Id of the dropdown)</p>
  <pre><code>    public async Task SetSelectedPeriod(string message)
      {
          if (selectModel != null)
          {
  
              int selectedValue;
              int.TryParse(message, out selectedValue);
              if (selectedValue &gt; 0)
                  selectedValue--;
              ...
              await UpdateViewModel();
          }
     }
  </code></pre>