title: How do I pass data between Razor components on the same Blazor page?
body: <p>I have this Blazor page</p>
  <pre><code>@page &quot;/bearoffdata&quot;
  @using BlazorBoinq.Components
  
  &lt;h3&gt;Bearoff Data&lt;/h3&gt;
  
  &lt;Position_Hex_IdPair /&gt;
  
  &lt;PositionData /&gt;
  
  @code {
  
  }
  </code></pre>
  <p>with these two Razor components:</p>
  <pre><code>@using BlazorBoinq.Data
  @using BgBearoffCoreNamespace;
  @inject BgBearoffService BoService
  
  &lt;label&gt;Position&lt;/label&gt;
  
  &lt;input type=&quot;text&quot; spellcheck=&quot;false&quot; @bind-value=&quot;@PositionText&quot; @bind-value:event=&quot;oninput&quot; /&gt;
  
  &lt;span&gt; = &lt;/span&gt;
  
  &lt;input type=&quot;number&quot; step=&quot;1&quot; @bind-value=&quot;@PositionId&quot; @bind-value:event=&quot;oninput&quot; /&gt;
  
  &lt;label&gt;Id&lt;/label&gt;
  
  @code {
  
      BgBearoffCore BgBo;
  
      protected override async Task OnInitializedAsync()
      {
          BgBo = await BoService.GetBgBearoffAsync();
      }
  
      private Int64 positionId;
      private String positionText;
  
      protected Int64 PositionId
      {
          get =&gt; positionId;
          set
          {
              positionId = value;
              if (positionId &gt; 0 &amp;&amp; positionId &lt;= BgBo.MaxId)
              {
                  positionText = BgBearoffCore.menOnPointToHexString(BgBo.getMenOnPointFromInvariantId(positionId));
              }
              else
                  positionText = &quot;&quot;;
          }
      }
  
      protected String PositionText
      {
          get =&gt; positionText;
          set
          {
              positionText = value;
              if (BgBo.IsValidHexPosition(positionText))
                  positionId = BgBo.getInvariantIdFromPosition(positionText);
              else
                  positionId = 0;
          }
      }
  }
  </code></pre>
  <p>and</p>
  <pre><code>@using BlazorBoinq.Data
  @using BgBearoffCoreNamespace;
  @inject BgBearoffService BoService
  
  &lt;button class=&quot;btn btn-primary&quot; @onclick=&quot;ShowBearoffInfo&quot;&gt;Show Data&lt;/button&gt;
  
  &lt;br&gt;
  
  &lt;textarea cols=&quot;36&quot; rows=&quot;36&quot; readonly @bind=&quot;@BearoffInfo&quot; /&gt;
  
  
  @code {
      BgBearoffCore BgBo;
  
      protected override async Task OnInitializedAsync()
      {
          BgBo = await BoService.GetBgBearoffAsync();
      }
  
  
      private String bearoffInfo = &quot;&quot;;
      public String BearoffInfo
      {
          get =&gt; bearoffInfo;
          set { }
      }
      protected void ShowBearoffInfo()
      {
          bearoffInfo = BgBo.getPositionInformationText(86);
      }
  }
  </code></pre>
  <p>I want to pass the <code>PositionId</code> of the first component to the second component, so I can replace hard-coded 86 in the last line, with the <code>PositionId</code> parameter.</p>