Introduzione a Jquery Template

A questo link trovate un interessante articolo che spiegal'utilzzo dei Jquery Template in asp.net

   2:  <html xmlns="http://www.w3.org/1999/xhtml">
   3:  <head>
   4:      <title>Intro</title>
   5:      <link href="0_Site.css" rel="stylesheet" type="text/css" />
   6:  </head>
   7:  <body>
   8:   
   9:      <div id="pageContent">
  10:       
  11:          <h1>ASP.NET Bookstore</h1>
  12:   
  13:          <div id="bookContainer"></div>
  14:       
  15:      </div>
  16:   
  17:      <script id="bookTemplate" type="text/x-jQuery-tmpl">
  18:          <div>
  19:              <img src="BookPictures/${picture}" alt="" />
  20:              <h2>${title}</h2>
  21:              price: ${formatPrice(price)}
  22:          </div>
  23:      </script>
  24:   
  25:      <script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.4.4.js"></script>
  26:      <script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jquery.templates/beta1/jquery.tmpl.js"></script>
  27:   
  28:      <script type="text/javascript">
  29:          // Create an array of books
  30:          var books = [
  31:              { title: "ASP.NET 4 Unleashed", price: 37.79, picture: "AspNet4Unleashed.jpg" },
  32:              { title: "ASP.NET MVC Unleashed", price: 44.99, picture: "AspNetMvcUnleashed.jpg" },
  33:              { title: "ASP.NET Kick Start", price: 4.00, picture: "AspNetKickStart.jpg" },
  34:              { title: "ASP.NET MVC Unleashed iPhone", price: 44.99, picture: "AspNetMvcUnleashedIPhone.jpg" },
  35:          ];
  36:   
  37:          // Render the books using the template
  38:          $("#bookTemplate").tmpl(books).appendTo("#bookContainer");
  39:   
  40:   
  41:          function formatPrice(price) {
  42:              return "$" + price.toFixed(2);
  43:          }
  44:   
  45:      </script>
  46:   
  47:  </body>
  48:  </html>

posted @ giovedì 2 dicembre 2010 23:48

Print
«dicembre»
domlunmarmergiovensab
24252627282930
1234567
891011121314
15161718192021
22232425262728
2930311234