-
Notifications
You must be signed in to change notification settings - Fork 25
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
3 changed files
with
40 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
@page | ||
@model DemoWeb.Pages.Demos.FormAction | ||
|
||
|
||
@{ | ||
Layout = "Shared/_Layout"; | ||
} | ||
|
||
<partial name="Shared/_StatusMessage" model="Model.StatusMessage"/> | ||
|
||
<form method="post"> | ||
<input type="submit" value="Submit" asp-page-handler="Submit" /> | ||
<input type="submit" value="Save" asp-page-handler="Save"/> | ||
</form> |
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,25 @@ | ||
using Microsoft.AspNetCore.Mvc; | ||
using Microsoft.AspNetCore.Mvc.RazorPages; | ||
|
||
namespace DemoWeb.Pages.Demos; | ||
|
||
public class FormAction : PageModel | ||
{ | ||
[TempData] | ||
public string? StatusMessage { get; set; } | ||
|
||
|
||
public IActionResult OnPostSubmitAsync() | ||
{ | ||
StatusMessage = "Submit button clicked"; | ||
|
||
return RedirectToPage(); | ||
} | ||
|
||
public IActionResult OnPostSave() | ||
{ | ||
StatusMessage = "Save button clicked"; | ||
|
||
return RedirectToPage(); | ||
} | ||
} |
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