August 2018
Intermediate to advanced
298 pages
5h 33m
English
A partial view can be called using the @Html.Partial HTML helper.
In our case, we will be calling the partial view from the Index2.cshtml file. The parameter that you pass will be the name of the partial file. It will search for the partial view by that name and render that complete content as part of the Index2.cshtml file.
The content of the Index2.html file will now be as follows:
Hello. This text will be rendered in body of the layout page<br /><br /><br />@Html.Partial("_PartialHelloWorld")
Now, run the application and access the URL http://localhost:50132/Home/Index2. You'll see the following output:
Also, look at the other overloads of @Html.Partial by right-clicking ...
Read now
Unlock full access