Home >Web Front-end >HTML Tutorial >MVC page jump and loading_html/css_WEB-ITnose

MVC page jump and loading_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 11:51:261355browse

Page jump method 1:

@Html.ActionLink("Register","Register")

@Html.ActionLink (page display text, view name)

Page jump method two: through controller

@Html.ActionLink("Home", "Index", "Home")

@Html.ActionLink(page display text, action, controller)

Page loading method:

  1. Overall view loading: via Load the @RenderBody() of the initial layout page.

  1. Embed the MVC user control into the View:
    1. Method 1:

@{Html.RenderPartial("SearchboxPartial");}: The MVC user control at this time must be placed in the same location as the caller In a directory, it can also be placed in View/Shared.

@{Html.RenderPartial("../../Views/ControlsPartial/SearchboxPartial");} The path must be accurate.

can be abbreviated as @{Html.Partial("../../Views/ControlsPartial/SearchboxPartial");}

  1. Method 2:

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

can be abbreviated as:

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

@{Html.RenderAction(action, controller);}

The execution order is: controller-model-view

  1. Loading of partial views:

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

Generally in brackets: it is a string composed of html tags, and the data is transmitted through viewData. Generally, there are actions with the same name

The execution order is controller->model->partialview->view

  1. In addition to the above overall view, user control, partial view, and An important view in MVC applications: Model view. Model view is actually a view of custom events. This view uses various Model classes under the Model folder to generate various editing pages, and then verifies events and User interaction.

This kind of view can be loaded as a whole view or as a partial view, or as a partial view. It can be obtained by page jump.

js can call the controller, which also enriches the loading method of the page. Readers are asked to study by themselves.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn