Using html.partial nested pages under ASP. NET MVC (functionally equivalent user control)

Source: Internet
Author: User

return View () related introduction

When you return to view in ASP. Viewresult, it inherits from Viewresultbase and it has a brother Partialviewresult. One to return the whole, and the other to return the local (HTML)

Use the relevant

1, controller writing: Except for the last change to "return Partialview ()" The remaining no difference

2, depending on the book write: @Html. Partial () has four overloads. Choose according to the situation

@Html. Partial ("Customerlistcontrol") when you write this, query all files named "Customerlistcontrol", take the first (in ascending alphabetical order) nesting

@Html. Partial ("Customerlistcontrol"); @* Fuzzy Query the specified file within the Web, with the same name in ascending order by suffix *@
@Html. Partial ("/views/home/viewusercontrol.ascx"); @* Specifying path/File *@
@Html. Partial ("Customerlistcontrol", @Model);
@Html. Partial ("Customerlistcontrol", viewdatadictionary); @*viewdatadictionary ViewData dictionary *@
@Html. Partial ("Customerlistcontrol", @Model, viewdatadictionary);

Using html.partial nested pages under ASP. NET MVC (functionally equivalent user control)

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.