You can use child actions together with the Html.Action and Html.RenderAction helpers . So let's take a closer look at an example.
, , ( ):
public class InboxViewModel
{
public int NumberOfUnreadMails { get; set; }
}
:
public class InboxController : Controller
{
public ActionResult Index()
{
InboxViewModel model = ...
return View(model);
}
}
(~/Views/Inbox/Index.ascx):
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %>
<%: Html.ActionLink("Inbox - " + Model.NumberOfUnreadMails, "Index", "Home") %>
, , , :
<div class="leftMenu">
<% Html.RenderAction("Index", "Inbox"); %>
</div>