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...
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.
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");}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With