Articles → ASP .NET MVC → Partial Views In Asp.Net MVC
Partial Views In Asp.Net MVC
Creation Of Partial Views
- Right click on the view\shared folder and click on Add – View..
Click to Enlarge
- Add View’ appears, check on ‘Create as partial view’ checkbox as shown in the following figure
Click to Enlarge
- Click on ‘Add’. A partial view will be added in shared folder.
- Inside the partial view class, add following code
<table>
<tr>
<td><a href="http://google.com" target="_blank">Google</a></td>
</tr>
<tr>
<td><a href="http://bing.com" target="_blank">Bing</a></td>
</tr>
</table>
Adding Partial View In The View
@{
ViewBag.Title = "Home Page";
}
@Html.Partial("SideBar")
Output
Click to Enlarge