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:
- Loading the overall view: load the view by @ RenderBody () on the initial layout page.
- Embed the MVC user control into the View:
- 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");}
- Method 2:
@{Html.RenderAction("PermissionBtnsPartial","ControlsPartial");}
Can be abbreviated:
@{Html.Action("PermissionBtnsPartial","ControlsPartial");} @{Html.RenderAction(action,controller);}
The execution sequence is controller-model-view.
- 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.
- 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.