MVC page Jump and loading, MVC page Jump Loading

Source: Internet
Author: User
Tags actionlink

MVC page Jump and loading, MVC page Jump Loading

Page jump Method 1:

@ Html. ActionLink ("Register", "Register") @ Html. ActionLink (Text displayed on the page, view name)

Page jump Method 2: PassController

@ Html. ActionLink ("Homepage", "Index", "Home") @ Html. ActionLink (page display text, action, controller)
 

Page loading method:

  1. Loading the overall view: load the view by @ RenderBody () on the initial layout page.

 

  1. Embed the MVC user control into the View:
    1. Method 1:
       @{Html.RenderPartial("SearchboxPartial");}

In this case, the MVC user control must be placed in the same directory of the caller, or in View/Shared.

@{Html.RenderPartial("../../Views/ControlsPartial/SearchboxPartial");}

The path must be accurate.

Can be abbreviated

@{Html.Partial("../../Views/ControlsPartial/SearchboxPartial");}


  1. Method 2:

 

@{Html.RenderAction("PermissionBtnsPartial","ControlsPartial");}

Can be abbreviated:

 

@{Html.Action("PermissionBtnsPartial","ControlsPartial");} @{Html.RenderAction(action,controller);}

The execution sequence is controller-model-view.

 

 

  1. Loading of some views:

@Html.Raw(@ViewData["PermissionBtns"].ToString())

In brackets: A string consisting of html tags. Data is transmitted in viewData mode. Generally, there are actions with the same name.

 

The execution sequence is controller-> model-> partialview-> view.

 

 

  1. In addition to the overall view, user controls, some views, and an important view in the MVC application, the Model view is actually a view of custom events, this view uses various Model classes in the Model folder to generate various editing pages, and then interacts with users through verification events.

 

This type of view can be loaded either in the whole view or in part of the view, or through page Jump.

 

Js can call controller, which enriches the page loading method. Please study it on your own.

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.