From 0a54588472665b0641ac4162b30988da88e3c4da Mon Sep 17 00:00:00 2001 From: Jason Zhu <jasonzhuyq@outlook.com> Date: Wed, 14 Jul 2021 20:54:04 +1000 Subject: [PATCH] e.g. 3.10 Creating a Form View --- .../PartyInvites/PartyInvites.csproj | 1 + .../PartyInvites/Views/Home/RsvpForm.cshtml | 31 +++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 chap3_your_first_mvc_app/PartyInvites/Views/Home/RsvpForm.cshtml diff --git a/chap3_your_first_mvc_app/PartyInvites/PartyInvites.csproj b/chap3_your_first_mvc_app/PartyInvites/PartyInvites.csproj index c684ce8..cf4ffa6 100644 --- a/chap3_your_first_mvc_app/PartyInvites/PartyInvites.csproj +++ b/chap3_your_first_mvc_app/PartyInvites/PartyInvites.csproj @@ -145,6 +145,7 @@ <Content Include="Scripts\jquery.validate.unobtrusive.js" /> <Content Include="Scripts\jquery.validate.unobtrusive.min.js" /> <Content Include="Scripts\modernizr-2.8.3.js" /> + <Content Include="Views\Home\RsvpForm.cshtml" /> <Content Include="Web.config" /> <Content Include="Web.Debug.config"> <DependentUpon>Web.config</DependentUpon> diff --git a/chap3_your_first_mvc_app/PartyInvites/Views/Home/RsvpForm.cshtml b/chap3_your_first_mvc_app/PartyInvites/Views/Home/RsvpForm.cshtml new file mode 100644 index 0000000..b817dbf --- /dev/null +++ b/chap3_your_first_mvc_app/PartyInvites/Views/Home/RsvpForm.cshtml @@ -0,0 +1,31 @@ +@model PartyInvites.Models.GuestResponse + +@{ + Layout = null; +} + +<!DOCTYPE html> + +<html> +<head> + <title>title</title> +</head> +<body> + @using (Html.BeginForm()) + { + <p>Your name: @Html.TextBoxFor(x => x.Name)</p> + <p>Your email: @Html.TextBoxFor(x => x.Email)</p> + <p>Your phone: @Html.TextBoxFor(x => x.Phone)</p> + <p> + Will you attend? + @Html.DropDownListFor(x => x.WillAttend, new[] + { + new SelectListItem() {Text = "Yes, I'll be there", Value = bool.TrueString}, + new SelectListItem() {Text = "No, I can't come", Value = bool.FalseString} + }, "Choose an option") + </p> + <input type="submit" value="Submit RSVP"/> + +} +</body> +</html> \ No newline at end of file