This about the simplest example of client-side templating. Four additions have been made to a standard page of html. First, the script tags on lines 6 to 8; second, the two xml namespaces and the sys:activate=”*” in the body tag on lines 10 to 12; third, the parameters in the tbody tag on lines 27 to 32; and fourth, the binding expressions within the td tags on lines 34 to 40. For your own project, the Mix.svc on line 29 must be replaced with the name of your own service. “Presenters” on line 30 must be replaced with the name of the table you wish to display on the client. On line 31, $top is one of several possible fetchparameters. This one tells the Data Service how many records to return. On lines 34 to 40, the words following each binding correspond to the names of the database fields that will be displayed. This code, together with a stylesheet, produces the following result:
The styling for the table is based on a gridview on Matt Berseth’s website. To avoid adding to the markup, I omitted the rounded corners.
In my next few posts, I will extend this example.