2

In one time I need to return IndexParty model. Next I need to return IndexPerson model to a view.

 public Tuple<IndexParty> GetTuple(){
     var tuple = new Tuple<IndexParty>(model);
     return tuple;
 } 

My .cshtml class is here

@model Mymodel

<div class="hide partial-view" id="partyrelationship">
    @Html.Partial("../Party/Index", Mymodel)
</div>

Then I want to load as partial view.How can I do this?

tereško
  • 58,060
  • 25
  • 98
  • 150
user2901979
  • 239
  • 2
  • 6
  • 13

2 Answers2

0

You just need a PartyController.cs (inheriting from Controller) with an Index action that returns this model.

PartyController:

public ActionResult Index()
{
    return PartialView(GetTuple());
}
SethMW
  • 1,062
  • 1
  • 9
  • 10
0
@model dynamic

<div class="hide partial-view" id="partyrelationship">
    @Html.Partial("../Party/Index", Model)
</div>

I would also move your partial to it's own controller action rather than using the index action.

hutchonoid
  • 32,982
  • 15
  • 99
  • 104
  • When I try this it gave this error message 'System.Web.Mvc.HtmlHelper' has no applicable method named 'Partial' – user2901979 Jan 07 '14 at 12:26
  • I would take a look at this http://stackoverflow.com/questions/4047543/render-partial-view-with-dynamic-model-in-razor-view-engine-and-asp-net-mvc-3 – hutchonoid Jan 07 '14 at 12:31