Web Dev Matters and Me

Web Development Matters - HTML, XML, C#, .NET, AJAX/Javascript(jQuery), CSS, XML-XSLT

ME - LIFE,Philippines, Tokyo, ECE, PhilNITS/JITSE,情報処理, 日本語

things about Philippines, gaming, C# development and web development, how to make money in stock trading

Web Dev Matters and Me

T4 in ASP.NET MVC 2

One of the dilemmas I had with ASP.NET development is that, ASP.NET  render server controls their own way, stuffs like Gridviews, Radio button list, Check box list, etc. Sure it does the work and saves time, but not long enough, until future changes are considered. Also, flexibility in manipulating front-end things (CSS) would be hard, without altering the markup, adding classes or ids, etc...

I really liked ASP.NET server controls and data binding. Those made my life easy, but because of poor rendering technique, it is a disappointment (at least for me) to see that my markups are rendered poorly and non-standard compliant. (i never imagined stuffing things sandwiched by a span tag).

good thing, there is a nice feature for ASP.NET MVC that prevents me from, seemingly re-invent the wheel (i hate re-writing custom server controls when all it needs is some mark-up changes). Code Templates T4 (Text Template Transformation Toolkit) will make rendering easy and gives you full control on the mark-up.

these T4 is a format that expresses how a model will be rendered. So if you got a lot of datas to be displayed, it doesn't necessarily mean to render it as a table or nest controls inside span, etc...

So, once you got a View, just specify a T4 template that it will use for the model datas that it will display, and there you got it, a web application that implements a separation of concern, front end developers just deal with their CSS and javascripts.

0 comments:

FB Connect