Saturday, August 24, 2013

Why to go with Editor Templates instead of partial views in MVC?

The problem with partials is that they do not preserve the navigational context. This means that any input fields that you might have put inside this partial will have incorrect names and the default model binder will not be able to retrieve the values back when you POST.


To make partial views to preserve the values while doing the http post we need to pass the top level model(parent view model) to partial view.

No comments:

Post a Comment