4

I need to populate a list box in a partial view, using ASP.NET MVC4.

Can Partial View have its own @model, as opposed to taking a model from its parent as described here?

I can populate my dropdown box using a separate AJAX call to another MVC controller (i.e. not parent page/url) as discussed here, but the resulting syntax is a bit more clumsy; furthermore, an additional endpoint is exposed to the outside world.

1 Answer 1

6

Yes - you can call partial view with any model you like. There is no requirement that data somehow comes from current model.

  @Html.Partial("PartialView1", new MyOtherModel(42))
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.