I'm building a Model in my Controller that I want to pass through an ActionResult on a different Controller. So in the Controller I have:
Public Class IndexViewModel
Sub New()
Ribbon = New Ribbon.RibbonViewModel
etc...
End Sub
Property Ribbon As Ribbon.RibbonViewModel
End Class
And then in the Razor View I make a call to render it like so:
@ModelType ANA.Inbox.IndexViewModel
<div>
@Html.Action("Index", "Ribbon", Model.Ribbon)
</div>
which goes to the RibbonController, which looks like:
Function Index(Optional Model As RibbonViewModel = Nothing) As PartialViewResult
If (Model Is Nothing) Then
Model = New RibbonViewModel
End If
Return PartialView(Model)
End Function
Before I even hit that first If(), I'm hitting a call to RibbonViewModel's constructor to create a new one instead of using the one I'm passing. Any ideas?
If you are not doing anything complex in Action, it will be better to use Html.Partial method to render partial view without calling action method