Click here to Skip to main content
15,998,100 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am trying bind data to jtemplete, but failed even not getting any error ,

please help me guys..

Here My Aspx code

XML
<script src="../js/jtemplates.js"></script>
    <script type="text/javascript">

         $(document).ready(function () {
             $.ajax({

                 type: "POST",
                 url: "frmUser.aspx/GetUserList",
                 data: "{}",
                 contentType: "application/json; charset=utf-8",
                 dataType: "json",
                 success: function (data) {
                     $('#userContainer').setTemplateURL('../JTemplate/User.htm');
                     $('#userContainer').processTemplate(data.d);

                 },
                 error: function () {
                     alert("Error");
                 }
             });
         });
         </script>
    <div id="userContainer">

    </div>


XML
Here My Cs Page Code
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Services;
using Bl;

namespace HotelManagementSystem.Masters
{
    public partial class frmUser : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            // GetUserList();

        }

       [WebMethod]
        public static List <UserDetails> GetUserList()
        {
           return  Bl.Users.GetUserList();
        }
    }
}


here my jtemplate

<div>
    <h3>User List</h3>
    {#foreach $T as user}
    <div>{$T.user.FirstName}</div>
    {#/for}
</div>
Posted
Comments
Jameel VM 8-Sep-13 10:17am    
what is the error?
Nilesh 87 8-Sep-13 10:40am    
data is not bind to template even not getting any error

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900