Microsoft
70-515 · Question #178
You are developing an ASP.NET MVC2 view and controller. The application includes a class names Employee that has a LastName property. The controller requires an action method that will insert an…
The correct answer is C. Add the Required attribute to the LastName property. See the full explanation below for the reasoning.
Question
You are developing an ASP.NET MVC2 view and controller. The application includes a class names Employee that has a LastName property. The controller requires an action method that will insert an Employee instance into a database. You need to ensure that the data that is submitted is an Employee instance and that a LastName value is given. What should you do?
Options
- AAdd a ValidationMessage helper method immediately after the view's last name TextBox.
- BAdd the Required attribute to the LastName property.
- CAdd the Required attribute to the LastName property.
- DAdd the ValidationMessage helper method immediately after the views last name TextBox.
How the community answered
(55 responses)- A15% (8)
- B4% (2)
- C76% (42)
- D5% (3)
Community Discussion
No community discussion yet for this question.