There are two ways to invoke views:
One: direct call (without controller)
<body>
@Html. Partial (".. /shared/error ");
</body>
Two: Call through controller
<body>
@Html. Action ("Dismode", "Shared")
</body>
Note:
Action, Renderaction Load method of the view, the execution of the Controller→model→view order, and then the resulting page back to the original view and then callback.
Partial, renderpartial Direct load View file contents
Example of invoking a partial view:
Create a new controller: return to partial view
public class Admincontroller:controller
{
Public ActionResult Updateadmin ()
{
var testObj =
new
List<
string
>()
{
"aaa"
,
"bbb"
,
"ccc"
};
Return Partialview ("Updateadmin", testobj);
}
}
Add a view in the shared folder of views Updateadmin
Several ways to invoke a view
1. Jquery Calls
$ (function () {
$ ("#load"). Load ("/admin/updateadmin");
})
2. Html.action Call
As follows:
@Html. Action ("Updateadmin", "Admin")
3. Direct call without Controller
As follows:
@Html. Partial ("Updateadmin", new
List<
string
> {
"ccc"
,
"ddd"
,
"eee"
) }
Call method Summary between MVC views