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.
Add a new web form
Recipe1.aspx
to the current project.We will define an Employee array on the client side containing data fields such as
EmployeeID
,Name
,Email
, andContact
. A snippet of the array structure is as follows:var EmpData = [ { EmpID: "I53434", Name: "Richard Tan", Email: "[email protected]", Contact: "+65 24242444"} ];
We aim to display this data using templates in the following format:
Define the corresponding ASPX markup to define the previous table structure as follows:
<form id="form1" runat="server"> <div align="center"> <table border="1" cellspacing="2" cellpadding="2" id="contentTble"> <tr class="header"> <td>Employee ID </td><td>Employee Name</td> <td>Email</td> ...