Wednesday, September 14, 2016

Passing ViewData to a Partial View

If you want to pass ViewData (via the ViewDataDictionary) to a Partial View, searching through forums, you may end up getting confusing or conflicting answers.

Fortunately, the solution is relatively simple whether you are using @Html.RenderPartial or @Html.Partial!


Then if you want to access that ViewData in your Partial View, you simply access it by doing something like the following:

No comments:

Post a Comment