Parital view is similar as asp.net user control. Sometime we need to display the data in multiple pages so we can create parital view in mvc.In other words if you want to reuse view you can go for partial view concept in mvc. So here I am going to explain how to create partial view in mvc
First create mvc web application than right click on shared folder =>add view =>_GetData as show in figure given below

So partial view .cshtml page
@{
Layout = null;
}
<div>
parital view
</div>
So we have called from parent view
@Html.Partial("_GetData")
@{Html.RenderPartial("_GetData");}
If you need to create strongly parital view. Then you have to pass model
@Html.Partial("_GetData",yourModelName)
No comments:
Post a Comment