0

I inherited a half-finished undocumented project recently and am struggling to comprehend all of the seemingly normal code, such as this use of @Html.Partial.

@Html.Partial("_myPartial", new myModel { Text = "myParam" })

There is no _myPartial.cshtml anywhere to be found in the code and I believe it was simply omitted but before I loose any more hair I'd like to get confirmation. I don't believe this code is capable of creating the partial view on its own. Pass a model to an existing partial - sure. Create one out of thin air - maybe not so much.

Is there any possibility that this code could produce the partial view in its entirety?

Greg Hayden
  • 135
  • 1
  • 3
  • 12
  • does a method named _myPartial exist in that controller? – Mike Wallace Mar 02 '16 at 15:07
  • Nope. Nowhere to be found anywhere in the code. Not in any of the 100+ controllers, not in the 300+ views and nowhere in the 20,000 lines of JavaScript. I really think it was something intended but never completed and I don't think it ever worked; especially, since you're just passing an empty model. However, that fact that I've never used a partial for such a purpose doesn't someone found a way to do it. – Greg Hayden Mar 02 '16 at 23:05

0 Answers0