I want to pass my ViewModel (not IEnumerable) to my own html helper
I did on IEnumerable like this:
Helper:
public static IHtmlString GenerateTable<TModel, TValue>(this HtmlHelper<TModel> inHtml, IEnumerable<TValue> model)
View:
@Html.GenerateTable(Model)
But how can I pass a model that is not IEnumerable for the helper?
I tried this:
public static MvcHtmlString MyHelper<TModel>(this HtmlHelper<TModel> html, object obj)
{}
but when I call it that
@Html.MyHelper(Model)
obj always NULL
source
share