MVC displays data in a view with a non-Entity Framework (II)

Source: Internet
Author: User

This "MVC uses non-Entity Framework to display data in the View" http://www.cnblogs.com/insus/p/3364235.html is also considered MVC view to display the database data, but a little bad, is to instantiate the object directly in the view fruicategoryentity, while the controller is keep empty and nothing is written.

So in this blog post, Insus.net wants to use a different method to try to write the data of the view and pass it to the view in the controller. The code is also changed less, a few small places can be.

Then we go to rewrite the view file category\index.cshtml:



Comment out the first line of code, add page # #. Rewrite the #26 line code. The results of the final view run unchanged. It can be imagined that the method is a variety of, to see their choice.

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.