Best practices for developing simple ASP.NET sites (built-in controls or jQuery + scripts)

I recently looked at code written by two different contractors, both of which were ASP.NET management base sites. Sites allowed the user to view and edit data. Pretty simple CRUD gateways.

One group did their best to use the ASP + AJAX Toolkit built-in controls and did their best to use as many built-in controls as possible. This pretty much matched most of the asp dev I saw. I found the code much easier to read and maintain.

The other jQuery used and the code are heavily labeled with script blocks, which are then used to create pages from javascript files.

Script block example:

  <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>

( js) - .

 $("#HRPanel").html($("#HRPanel").parseTemplate({ HRRows: response.something.bah.bah }));

js html-. aspx , , html-.

? , HTML- , javascript, ?

-, ? ? , jQuery / , Microsoft ?

+5
5

. , .

JQuery, . . .

JQGrid, JSON XML. , , . , . . , ? ?

Microsoft JQuery MVC. ? JQuery . , DOM, JavaScript-javascripts .

JQuery , , , . , ( javascript, , ).

JQuery , CSS. , , JQuery . :

http://attardi.org/labels/#info

http://net.tutsplus.com/articles/web-roundups/the-20-most-practical-and-creative-uses-of-jquery/

.:)

+5
+4

<Assuming_the_Worst > Javascript . ( , , -).

, , , , Javascript, ( , " - , " ). </Assuming_the_Worst >

, , , ASP.NET jQuery. , .

: , ASP.NET , , , , , , BWIKTBI ( , , ), .

+3

, ASP + AJAX Toolkit , . , , , .

jQuery - -. ASP.NET MVC, . script. jQuery. - ASP.NET jQuery . AJAX WCF AJAX. , .

+1

ASP.NET crappy html-, , . html , (IMO). , html , Excel. - CSS Friendly (http://www.asp.net/cssadapters/) , ( ). ListView - .NET 3.5, html.

I agree with others that using script blocks is less than ideal. My preference would be to use unobtrusive scripts that would then simply contain html elements as placeholders (no script tags, other than importing a js file).

0
source

All Articles