I was recently reviewing some code written by two different contractors, both were basic ASP.NET management sites. The sites allowed the user to view and edit data. Pretty much simple CRUD gateways.
One group did their best to use built in ASP + AJAX Toolkit controls and did their best to use as many built in controls as possible. It pretty much was in line with most of the asp dev i havhe seen. I found the code much easier to read and maintain.
The other used jQuery and the code is heavily marked up with script blocks which are then used to build pages from javascript files.
Example Script block:
<script id="HRPanel" type="text/html">
<table cellpadding='0' cellspacing='0' class="atable"><thead class="mHeader"><tr><th>Name</th><th>Description</th><th>Other</th></thead><tbody>
<# for(var i=0; i < hrRows.length; i++) {
var r = HRRows[i]; #>
<tr><td><#=r.Name#></td><td><#=r.Description#></td><td class="taRight"><#=r.Other#></td></tr>
<#}#>
</tbody><tfoot><th></th><th></th><th></th></tfoot></table>
</script>
Then in a separate location (js file) you would see something like this.
$("#HRPanel").html($("#HRPanel").parseTemplate({ HRRows: response.something.bah.bah }));
And in the js files you will just a bunch of toggling and manipulating of html code. There was no code in the aspx files except for blocks containing html markup.
Which one is more common? The one that basically leveraged embedded HTML markup in scripts controled by javascript files screams readability and maintenance issues?
Secondly what type of issues fall out of the second way? Do people really use code like that in real production environments? Are there tools that help facilitate jQuery development with visual studio, and/or is this a practice that Microsoft is going to make more streamline in the future?