Reputation: 34158
I have strongly typed list view
I have custom html helper which must get IEnumerable<object>
does it possible to pass my model(@model IEnumerable<MvcApplication2.Models.UserViewModel>
) to my html helper?
Upvotes: 0
Views: 2788
Reputation: 1038710
If your helper is defined like this:
public static IHtmlString SomeHelper(this HtmlHelper<IEnumerable<object>> html)
then it is not possible to call it like this:
@model IEnumerable<MvcApplication2.Models.UserViewModel>
@Html.SomeHelper()
If on the other hand it is defined like this:
public static IHtmlString SomeHelper(this HtmlHelper html, IEnumerable<object> model)
you could call it from your view and pass the model:
@model IEnumerable<MvcApplication2.Models.UserViewModel>
@Html.SomeHelper(Model)
Upvotes: 3