I have a strongly typed user control (‘partial’) and I’d like to be able to pass it some additional information from its containing view. For example, I have view that’s bound to a product class and i have a partial that also is strongly typed to that same model, but I also need to pass an additional parameter for imageSize to my partial. I’d like to be able to do something like this:
<% Html.RenderPartial('_ProductImage', ViewData.Model, new { imageSize = 100 }); %>
As far as I know there is no way to do this, but I’m hoping that someone smarter than me may have a solution 😉
Change the type of the partial model:
Now pass it: