diff --git a/Pages/Demos/FormAction.cshtml b/Pages/Demos/FormAction.cshtml new file mode 100644 index 0000000..396beab --- /dev/null +++ b/Pages/Demos/FormAction.cshtml @@ -0,0 +1,14 @@ +@page +@model DemoWeb.Pages.Demos.FormAction + + +@{ + Layout = "Shared/_Layout"; +} + + + +
+ + +
\ No newline at end of file diff --git a/Pages/Demos/FormAction.cshtml.cs b/Pages/Demos/FormAction.cshtml.cs new file mode 100644 index 0000000..6b0af33 --- /dev/null +++ b/Pages/Demos/FormAction.cshtml.cs @@ -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(); + } +} \ No newline at end of file diff --git a/Pages/Index.cshtml b/Pages/Index.cshtml index f22402a..31996c7 100644 --- a/Pages/Index.cshtml +++ b/Pages/Index.cshtml @@ -10,6 +10,7 @@
  • Submit Button
  • Removed Inputs
  • Select Input and Validation Summary
  • +
  • Form Action
  • @if (Model.StatusMessage != null) {