Reputation: 9621
I am having trouble with the following code:
@Html.RenderPartial("_SortDisplayPage", new ViewDataDictionary { { "bottomClass", "pagingBottom" } })
It gives the error:
Cannot implicitly convert type void to object
I think it's something small but cannot find it...
Upvotes: 12
Views: 6748
Reputation: 15953
The RenderPartial() call renders its result directly to the response object and cannot be used like a simple string.
All you have to do is enclose the call in a code block.
@{Html.RenderPartial("TopNavigation");}
Upvotes: 6
Reputation: 532445
You want @Html.Partial
not RenderPartial
. RenderPartial writes directly to the response and doesn't return a value. Partial returns an MvcHtmlString, which the @ operator will write to the response.
Upvotes: 29