2.2.1 Question
Multiple Choice
You are creating an ASP.NET MVC web application. The application must accept user input for a ProductName field. To reduce delays due to invalid entries making round trips between the client and server, user input should be validated on the client before being submitted to the server. Which code segment should you choose?
-
A. <div class="editor-label">@Html.LabelFor(model => model.ProductName)</div>
<div class="editor-field">@Html.EditorFor(model => model.ProductName)</div>
-
B. <div class="editor-label">@Html.LabelFor(model => model.ProductName)</div>
<div class="editor-field">@Html.ValidationMessageFor (model => model.ProductName)</div>
-
C. <div class="editor-field">
@Html.EditorFor(model => model.ProductName)</div>
@Html.ValidationMessageFor(model => model.ProductName) - D. <div class="editor-label">@Html.LabelFor(model => model.ProductName)</div>