4

I really like using the awesome templating engine called Smarty in Php.

I'm wondering if there is something akin to this for dotnet for doing a project in Asp.Net MVC(C#)? I have been looking and haven't been able to find anything yet.

Basically, I'd like to be able to on a pageload, access an object and the attributes of that object are then used to fill in the placeholders for where dynamic data would go.

Anybody have any ideas as to whether this is possible or what might support something like this?

amexn
  • 2,158
  • 6
  • 33
  • 56

3 Answers3

2

Check out Razor (MVC 3 required) or another one of the ASP.NET MVC View Engines:

Razor

Spark

Other View Engines: What templating engines are available for ASP.NET MVC Framework?

Community
  • 1
  • 1
DarrellNorton
  • 3,901
  • 2
  • 21
  • 21
0

Why not use ASPX page itself as a template - you can use data binding expressions to bind the data from mark-up and then execute it using HttpServerUtility.Execute method to get the html output.

VinayC
  • 47,395
  • 5
  • 59
  • 72
0

In ASP.NET MVC, you don't do any business logic in your Views (which would be your templates if you will), you only do presentation logic. And for your BL you have your Models and for all the wiring you have your Controllers. I personally think it's a very clean design and you always (well almost always :P) know where everything is supposed to go.

synepis
  • 1,292
  • 16
  • 28