asp.net mvc key Tutorials first-year 11th back master pages, user-defined controls, and file uploads

Source: Internet
Author: User

Master page (Master)

1. The master page is controller independent, and the master page is only a view file, and no controller corresponds to it.

2. In fact, the aspx of view in asp.net mvc is not as tightly associated with the master page as in WebForm.

For example, I want to replace an ASPX master page, and specify the master you want to use if you return in action:

As shown in figure I have 2 master files, and/views/home/index.aspx is

If we want to use Site2 as master, just return view in action to specify Mastername parameters:

1: public ActionResult Index() {
2:   return View (null,"Site2");
3: }

Custom controls

RenderPartial

In asp.net mvc, if you want to customize a control, you can't refer to it like WebForm with <cc1:xxxx/>, but use a helper.

For example, we build a ct.ascx

Related Article

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.