I have a blazor server app. The main layout of the pages is consisting of 1) Side Navigation screen 2) Header screen and 3) the body screen in the center of the page In the main screen (Page1) the client has to make a machine selection from a drop-down select box. What I want is very simple: I want that the selected machine is also shown immediatly in the header part(Page2). I have programmed a data-binding like below. But if a machine is selected , it is not shown in the header screen. Just when I manual reload the page I see the correct selected machine in the header screen. What is missing in my data binding?
Page1 (Body razor page in the "Pages" directory) Here is the data generated
@page "/Selection"
<select value="@selected_Machine" class="MAE" @onchange="func_MAE">
<option value="">-- Select Machine --</option>
<option value="">-- Machine-1 --</option>
<option value="">-- Machine-2 --</option>
<option value="">-- Machine-3 --</option>
</select>
@code {
public static string selected_Machine { get; set; };
void func_MAE(Microsoft.AspNetCore.Components.ChangeEventArgs e)
{
selected_Machine = e.Value.ToString();
}
}
Page2 (Header razor page in the "Shared" directory) Here the data should be actualised immediatly when data changes in Page1.
<p>Selected Machine: @Pages.Page1.selected_Machine</p>