PositiveGuy
PositiveGuy

Reputation: 47733

Templates and Partial Views - Use one OR the Other?

So I want to verify something. And that is to me you wouldn't need to use Partials at all if going the template route as your template is essentially providing the markup as a partial would but obviously you're doing it different via templates.

So you wouldn't use both. I assume If I'm going to go with something like Knockout, I'd probably most likely never use partials in my MVC app, correct?

Upvotes: 0

Views: 57

Answers (1)

Darin Dimitrov
Darin Dimitrov

Reputation: 1038710

I assume If I'm going to go with something like Knockout, I'd probably most likely never use partials in my MVC app, correct?

Yes, correct. Knockout is a client side templating engine that you could use and now your controller actions will return JSON instead of partial HTML.

But I wouldn't say that if you use a templating engine you will never use partial HTML. There are many things which would be hard to achieve with a client side templating engine. For example generating forms containing antiforgery tokens, input fields with client side validation attributes, ... -> they are just more easily generated on the server.

Upvotes: 1

Related Questions