ASP. NET MVC 5 Razor view does not reference an object to an instance

Source: Internet
Author: User

Today, when you are doing graduation design, when you load the model with @html.textboxfor (X=>x.name), the object is not referenced to the instance.

However, Textboxfor is not a control for displaying data, which is used here to load annotation properties that are attached to the model.

The solution is not to be baffled. After you delete this testboxfor control, the error is even more outrageous.

An error that does not reference an object to an instance actually points to @{leyout= ". Here, verify the path is correct "}.

Finally found in the original is in a <select. Name= "@Model Category" > pits himself. The load here requires data in the model, and the view engine may not be able to navigate here, prompting for some places in the view where this error is unlikely to occur.

Summary: When you are sure that the control that prompted the error is bound to the correct view model, you may want to check the location where the view data is required to be displayed elsewhere on the page.

ASP. NET MVC 5 Razor view does not reference an object to an instance

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.