Reputation: 1263
I am using MVC3, in which I have a page let say Home.cshtml with <Ul></Ul>
tag. Now I have 5 Partial View with li
and some html. Partial view are based on permission, I have this code in my controller.
List<IPermissionEntity> list => This return me list of permission.id of that user.
From DataBase I got Id, PartialView Name.
Now how can I call Partial View if permission.id = 1 then a particular partial view render. If permission to view two or three partial Views then how can i see them. I am trying with foreach loop and taken PartialView Name and trying to putting in @Url but still I am stuck for the same.
Upvotes: 0
Views: 693
Reputation: 47375
To render partial views, I think you want @Html.Partial, not @Url:
<ul>
@foreach (var permissionEntity in permissionEntities)
{
Html.Partial(permissionEntity.PartialViewName)
}
</ul>
Upvotes: 3