-
Notifications
You must be signed in to change notification settings - Fork 10.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
52 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
.../test/testassets/Components.TestServer/RazorComponents/Pages/FormStreamingRendering.razor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
@page "/form-streaming" | ||
@using Microsoft.AspNetCore.Components.Forms | ||
@attribute [StreamRendering(true)] | ||
|
||
<h1>Streaming Rendering</h1> | ||
|
||
@* This just sets the context for the binding, this happens normally inside RouteView *@ | ||
<CascadingModelBinder Name="/form-streaming"> | ||
<EditForm id="process" method="POST" OnValidSubmit="ProcessForm"> | ||
<input type="submit" value="Process form" /> | ||
</EditForm> | ||
</CascadingModelBinder> | ||
|
||
<p id="status"> | ||
@if (_processing) | ||
{ | ||
<text>Processing form...</text> | ||
} | ||
else if (_done) | ||
{ | ||
<text>Completed</text> | ||
} | ||
</p> | ||
|
||
@code { | ||
bool _processing = false; | ||
bool _done = false; | ||
|
||
private async Task ProcessForm() | ||
{ | ||
_processing = true; | ||
await Task.Yield(); | ||
_processing = false; | ||
_done = true; | ||
} | ||
} |