diff --git a/Pages/Demos/SelectInput.cshtml b/Pages/Demos/SelectInput.cshtml new file mode 100644 index 0000000..861f6da --- /dev/null +++ b/Pages/Demos/SelectInput.cshtml @@ -0,0 +1,26 @@ +@page +@model DemoWeb.Pages.Demos.SelectInput +@{ + Layout = "Shared/_Layout"; +} + +
+ Please correct the following errors +
+ +
+ Required Select input with validation summary. +
+
+ + + +
+
+ + + +
+ +
+
\ No newline at end of file diff --git a/Pages/Demos/SelectInput.cshtml.cs b/Pages/Demos/SelectInput.cshtml.cs new file mode 100644 index 0000000..384be99 --- /dev/null +++ b/Pages/Demos/SelectInput.cshtml.cs @@ -0,0 +1,25 @@ +using System.ComponentModel.DataAnnotations; +using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc.RazorPages; +using Microsoft.AspNetCore.Mvc.Rendering; + +namespace DemoWeb.Pages.Demos; + +public class SelectInput : PageModel +{ + [BindProperty] + [Required] + public string? Animal { get; set; } + + [BindProperty] + [Required] + public string? AnotherRequiredField { get; set; } + + public IReadOnlyList Animals => new List + { + new("None", ""), + new("Dog", "Dog"), + new("Cat", "Cat"), + new("Fish", "Fish"), + }; +} \ No newline at end of file diff --git a/Pages/Index.cshtml b/Pages/Index.cshtml index 9f8a740..f22402a 100644 --- a/Pages/Index.cshtml +++ b/Pages/Index.cshtml @@ -9,6 +9,7 @@
  • Checkboxes and Radio Buttons
  • Submit Button
  • Removed Inputs
  • +
  • Select Input and Validation Summary
  • @if (Model.StatusMessage != null) {