Calling a view from another view in MVC .Net

asp.net asp.net-mvc asp.net-mvc-4 entity-framework

Question

My perspective is titledLoggedIn.cshtml receiving a call fromLoggedInController . Within theLoggedInView My partial view is termed .LoggedInPartial to showcase thenav bar with many menus, like Home, Profile, etc.

I wish to dial another perspective.LoggedInHomeViewonClick of the main page's menunav There is a bar inside.LoggedInView .

How can I accomplish that?

1
2
9/2/2016 8:23:46 AM

Popular Answer

If you have a view named LoggedIn.cshtml, you may display a partial view called _LoggedInPartial in your view as follows:

{ Html.RenderPartial("_LoggedInPartial"); }

Generally, if _LoggedInPartial is used for navigation inside this view, links are rendered like:

<ul>
    <li>
        @Html.ActionLink("Title", "ActionName", "ControllerName")
    </li>
    <li>
        @Html.ActionLink("AnotherTitle", "AnotherActionName", "AnotherControllerName")
    </li>
</ul>

Now, if you click on a link, you ought to be sent to the requested action and have the view shown for you.

2
9/2/2016 8:17:26 AM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow