ASP. NET MVC View (iv)

Source: Internet
Author: User

Strongly-typed helper methods

Template-Assisted methods

Template-assisted methods in ASP. NET MVC use metadata and templates to build HTML, that is: template helper methods can generate appropriate HTML tags at run time using any of the appropriate "editors" using data annotations
Metadata includes information about model values (name and type) and model metadata (added through data annotations or custom providers).
Template-assisted methods have Html.display and Html.editor, which correspond to strongly-typed methods when Html.displayfor and Html.editorfor, corresponding to the complete model of the auxiliary method have Html.displayformodel and html.editorfor Model.

Understanding Modelstate

Modelstate is a byproduct of model binding and stores all validation errors detected during model binding, as well as the original values that the user submits to update the model.
The helper methods used to render form fields automatically look for their current values in the Modelstate dictionary. The helper method uses the name expression as the key to find in the Modelstate dictionary. If the lookup value is already in modelstate, the secondary method replaces the current value in the view data with the value in Modelstate.

ASP. NET MVC View (iv)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.