I don't understand how a partial view is handled by controller, is it the same as a view? I made an example and it seems that partial view controller is never used
This is the example
Main View (test.cshtml):
<h2>Main View</h2>
@Html.Partial("_Partial", new { myNumber = 11 })
Partial View (_Partial.cshtml):
<h3>partial view</h3>
<p>my number is @Html.ViewBag.myNumber</p>
Controller (EtlMessagesController)
public ActionResult Test() {
return View();
}
public ActionResult _Partial(int myNumber) {
ViewBag.myNumber = myNumber;
return PartialView();
}
When i invoke the main view I expect
Main View
partial view
my number is 11
But the nummber 11 is not written. Am I missing something?