Code in partial 1 file:
@Html.Partial("Partial2", 50)
Code in partial 2 file:
@if(passed in parameter == 50)
{
<div>50 Was Passed In</div>
}
Does this really require me to create a new controller?
Code in partial 1 file:
@Html.Partial("Partial2", 50)
Code in partial 2 file:
@if(passed in parameter == 50)
{
<div>50 Was Passed In</div>
}
Does this really require me to create a new controller?
Partial and RenderPartial don't require a controller. Action and RenderAction require a controller.
So your code in partial 2 should be:
@model int
@if(Model == 50)
{
<div>50 Was Passed In</div>
}
Also a good read is Html.Partial vs Html.RenderPartial & Html.Action vs Html.RenderAction
No, just add the model directive in Partial 2:
@model int
@if(Model == 50)
{
<div>50 Was Passed In</div>
}