MVC displays data in a view with a non-Entity Framework

Source: Internet
Author: User

Before you learn this, take a look at the DataTable data shown in the MVC application http://www.cnblogs.com/insus/p/3361182.html, which shows the DataTable on the MVC view.
Insus.net now uses the non-Entity Framework to display data on the view view. Just modify it on the basis of it.

First remove the following class from the models directory and recreate one:



Take a little note of namespace and write only two attributes. Then create an entity in the models directory:



Where the #15 and #19 lines are copied from the class fruitcategory of the previous old model.
Next Modify the controller:



Then, modify the view's index.cshtml:



Reference namespace, and instantiate Fruitcategoryentity (), when rendered, as in the previous article. Only the table header field is specified manually.
MVC site Run Effect:


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.