Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Passing model information to RenderPartial

Tags:

asp.net-mvc

Hi I have this line of code:

<% Html.RenderPartial("VenuesList"); %>

What I need to do is pass it my model via the additional parameters available in the overides. What do I write? My model is Venue. Thanks.

like image 838
Cameron Avatar asked Mar 25 '11 12:03

Cameron


1 Answers

You could use the following overload allowing you to pass a model to the partial:

<% Html.RenderPartial("VenuesList", Model.SomeProperty); %>

or directly the model if it is of the correct type as expected by the partial:

<% Html.RenderPartial("VenuesList", Model); %>
like image 200
Darin Dimitrov Avatar answered Oct 08 '22 13:10

Darin Dimitrov