Abhineet Srivastava

Abhineet Srivastava

  • NA
  • 890
  • 94.5k

json item to Jquery Templates

Sep 19 2013 2:29 AM
How can i show Json item to jquery tamplates in Web application?

My code is like this--

 System.Web.Script.Serialization.JavaScriptSerializer serializer = new System.Web.Script.Serialization.JavaScriptSerializer();
            List<Dictionary<string, object>> rows = new List<Dictionary<string, object>>();
            Dictionary<string, object> row;
            foreach (DataRow dr in dtTable.Rows)
            {
                row = new Dictionary<string, object>();
                foreach (DataColumn col in dtTable.Columns)
                {
                    if (col.ColumnName == "FirstName" || col.ColumnName == "LastName" || col.ColumnName == "MiddleName") if (col.ColumnName == "FirstName" || col.ColumnName == "LastName" || col.ColumnName == "MiddleName")
                        {
                            row.Add(col.ColumnName, dr[col]);
                        }
                }
                rows.Add(row);
            }
            string json = serializer.Serialize(rows);



Cheers

Answers (2)