On the Details view I want to display a grid from other table. How to implement it better? I'm trying to do it in a such a way (error: Cannot implicitly convert type 'void' to 'object'):
<%= Html.RenderPartial("~/Views/Appartament/Index.ascx", new { id = Model.blockhouse_id })%>
Here is the code from details view:
<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<testMVC.Models.Blockhouse>" %>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<h2>Details</h2>
<p>
blockhouse_id:
<%= Html.Encode(Model.blockhouse_id) %>
</p>
<p>
name:
<%= Html.Encode(Model.name) %>
</p>
<p>
Appartaments:
<%= Html.RenderPartial("~/Views/Appartament/Index.ascx", new { id = Model.blockhouse_id })%>
</p>
</asp:Content>
And the code of the Index.ascx controller:
public ActionResult Index(int blockhouse_id)
{
var _appartament = apt.GetBlockAppartaments(blockhouse_id).ToList();
return View("Index", _appartament);
}