ASP.NET jQuery Cookbook Examples
Using jQuery Templates to display data

Let's begin with the basics of defining inline templates in ASP.NET pages. We will create some sample data and then apply the same to the template.

The page will display the formatted content.

Employee ID Employee Name Email Contact
Click here to view the code.
$(document).ready(function () {
    var EmpData = [
        {
            EmpID: "I53434", Name: "Richard Tan",
            Email: "richard@someemail.com", Contact: "+65 24242444"
        },
        {
            EmpID: "I53435", Name: "Thomas Lee",
            Email: "thomas@someemail.com", Contact: "+65 8664664"
        },
        {
            EmpID: "I53436", Name: "Joseph Yeo",
            Email: "joseph@someemail.com", Contact: "+65 94643646"
        },
        {
            EmpID: "I53437", Name: "Jasmine D'Souza",
            Email: "jasmine@someemail.com", Contact: "+65 4225252"
        }
    ];

    $("#empTemplate").tmpl(EmpData).appendTo("#contentTble");
});