RsvpForm, - . , , (GuestResponse ), MVC , .
, , MVC . GuestResponse , , MVC . , BuildSolution Build VisualStudio.
RsvpForm AddView ( ), AddView. , ViewName ( ) RsvpForm, Template () Empty (), ModelClass ( ) - GuestResponse. ViewOptions ( ) :
Add, Visual Studio RvspForm.cshtml Views/Home . . HTML-, Razor- @model. , .
@model PartyInvites.Models.GuestResponse @{ Layout = null;} <!DOCTYPE html> <html><head><metaname="viewport"content="/><title>RsvpForm</title></head><body><div></div></body></html>, , , . , , @model .
, , RsvpForm.cshtml, HTML- GuestResponse, :
@model PartyInvites.Models.GuestResponse @{ Layout = null;} <!DOCTYPE html> <html><head><metaname="viewport"content="/><title>RsvpForm</title></head><body> @using (Html.BeginForm()) {<p>: @Html.TextBoxFor(x =>x.Name)</p><p> email: @Html.TextBoxFor(x =>x.Email)</p><p> : @Html.TextBoxFor(x =>x.Phone)</p><p>? @Html.DropDownListFor(x =>x.WillAttend, new[] {newSelectListItem() { Text = ", ", Value = Boolean.TrueString},newSelectListItem() { Text = ", ", Value = Boolean.FalseString} })</p><inputtype="submit"value=" RSVP" />}</body></html>GuestResponse HTML, HTML input. - , input, :
|
|
HTML TextBoxFor HTML- input, type text, id name - Email ( ):
<input id="Email" name="Email" type="text" value="" />, RsvpForm , MVC , GuestResponse - , . HTML , , @model.
- :
@Html.TextBox("Email")- , .. VisualStudio IntelliSense, :
Html.BeginForm(), HTML- form, . , , URL, HTML-. , C#- using, :
@using (Html.BeginForm()) { // ... }using , . , , , . ( using , - .)
Html.BeginForm HTML- form, . , Html.BeginForm :
<form action="/Home/RsvpForm" method="post"> //... </form>, C#. , HTML.