jQuery templates allow us to execute callback functions for further processing of the formatted contents before rendering it on the page. In this recipe, let's see how we can use the callback function to highlight alternate rows of a table. We will use the web services example described earlier and execute a callback function for each item in the returned response object.
Add a new web form
Recipe6.aspx
to the current project.Add a css class to hide elements on the form:
.hide { display:none; }
Add a css class to highlight the background color of a row:
.highlight { background-color:Silver; }
Add a button control to the form to trigger the AJAX request. Also add the following markup to the form to render the data received from the web service.
<form id="form1" runat="server"> <div align="center"> <asp:Button ID="btnSubmit" runat="server" Text="Click to retrieve Employee data" /> <...