我用Darin的上方,併成功地應用它來演示:
@model RequestAQuote.Models.RequestAQuoteModel
@{
ViewBag.Title = "Request a Free Quote";
List<string> ProjectTypes = new List<string>();
ProjectTypes.Add("Electrical Wiring");
ProjectTypes.Add("Install Breakers");
ProjectTypes.Add("Ceiling Fan");
ProjectTypes.Add("Replace Light");
ProjectTypes.Add("Replace Outlet");
}
<h2>Request A Quote</h2>
@using (Html.BeginForm())
{
@Html.ValidationSummary()
<fieldset>
<legend>Request a Quote Form</legend>
<ol>
<li>
@Html.LabelFor(m => m.ProjectType)
@Html.DropDownListFor(m => m.ProjectType, new MultiSelectList(ProjectTypes))
</li>
<li>
@Html.LabelFor(m => m.ContactName)
@Html.EditorFor(m => m.ContactName, new { autocomplete = "off" })
</li>
<li>
@Html.LabelFor(m => m.DaTimePhone)
@Html.EditorFor(m => m.DaTimePhone, new { autocomplete = "off" })
</li>
<li>
@Html.LabelFor(m => m.Email)
@Html.EditorFor(m => m.Email, new { autocomplete = "off" })
</li>
<li>
@Html.LabelFor(m => m.ProjectDescription)
@Html.EditorFor(m => m.ProjectDescription, new { autocomplete = "off" })
</li>
</ol>
<input type="submit" value="Request Quote" />
</fieldset>
}
@section scripts
{
@Scripts.Render("~/bundles/jqueryval")
}
}
您的腳本很棒! – Kbdavis07 2014-05-14 03:50:40