Program.cs
When you run, the left bar and header come from the main layout. The center comes from the @Body/Pages.
@Body has the main content which comes from the page components
@attribute [StreamRendering]
Mark any part of the dom as retained during navigation
add data-permanent:
<form data-permanent>
<input type="text" />
</form>
form requires a name:
<EditForm FormName="" method="post" Model="@Item" OnValidSubmit="SaveAsync">
<DataAnnotationsValidator/>
<InputText @bind-Value="@Item.Name" autocomplete="no"/>
<ValidationSummary/>
</EditForm>
-bind new incoming http post data to a paricular .net object -this is how you control how post data gets mapped onto your objects
@code {
[SupplyParameterFromForm]
public Product Item {get;set;}=new();
-if you have multiple, then:
[SupplyParameterFromForm("FormName="")]
-mark forms as Enhance to integrate with Enhanced Navigation <EditForm Enhance FormName="" ... -this turns on Enhanced form handeling for this form -when the form is submitted, blazor will intercept that form request and substitute a fetch request. -then when the form renders its responce, blazor will intelligently patch the response data into the dom. -very similar to enhanced navigation, but with forms
-you can also use streaming rendering with this -then add a Loading... to button
chatState._navigationManager.Refresh();
<Calendar @rendermode="InteractiveServer"/>
@page "/counter/{v?}" // ? means optional
@page "/counter/{v:int?}"
@layout Layout.MainMayout
Right click on @code to move cs code to another file