Subscribe

Close

Thank you for visiting!

Please consider subscribing to the RSS feed or following me on Twitter.

Adding Additional ViewData

Sometimes you want to add additional View Data to your Partial, while retaining your current View Data. The solutions is very easy. Just use this.ViewData in your constructor overload, and add the new View Data as usual:

@Html.Partial("_Product", prod, new ViewDataDictionary(this.ViewData)
{{ "Addons", "Product Addons"},{ "AdditionalCategory", "Category" }})

To the top