Click here to Skip to main content
12,758,323 members (35,774 online)
Rate this:
Please Sign up or sign in to vote.
I need to insert form data into sql database using AJAX with JSON and show in gridview.
Can anybody help me?
Thanks in advance.
Posted 23-Nov-11 20:27pm
Updated 24-Nov-11 19:37pm
Sunasara Imdadhusen 24-Nov-11 5:45am
Have you written any code for that?
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

// You can use below link to insert data through AJAX- JSON


//To show data you can use following code which gets data from webservice through JSON and rendor it in HTML table and apply CSS to it.

 var CompanyId = document.getElementById("CompanyId").value;
    var UserId = document.getElementById("_UserId").value;
    var RoleId = $("#RoleId").val();
        type: "POST",
        url: "../../WebService/CustomerOrder.asmx/GetOrderTrackingData",
        data: "{CompanyId:" + CompanyId + ",UserId:" + UserId + ",WhereCondition:'" + WhereCondition + "',RoleId:'" + RoleId + "'}",
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        success: function(data) {
            var OrdTrackingData = (typeof data.d) == 'string' ? eval('(' + data.d + ')') : data.d;
            for (var i = 0; i < OrdTrackingData.length; i++) {
                $("#tbody").append("<tr><td id="tdOrderid" style="display:none">" + OrdTrackingData[i].OrderId + "</td>" +
                                        "<td class="Normal">" + OrdTrackingData[i].PWSID +
                                        "</td><td class="Normal">" + OrdTrackingData[i].OrderNo + "</td>" +
                                        "<td class="Normal">" + OrdTrackingData[i].Status + "</td>" +
                                        "<td class="Normal">" + OrdTrackingData[i].Name + "</td>" +
                                        "<td class="Normal">" + OrdTrackingData[i].Price + "</td>" +
                                        "<td class="Normal">" + OrdTrackingData[i].Service + "</td>" +
                                        "<td class="Normal">" + OrdTrackingData[i].OrderDate + "</td>"

        error: OnError

Mark as solution if its solved your problem.
Rate this: bad
Please Sign up or sign in to vote.

Solution 3

i finally find the solution for this..and it works efficiently.. :)

//in .aspx page
<%@ Page Title="Home Page" Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs"
    Inherits="_Default" %>

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

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

    Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170217.1 | Last Updated 19 Feb 2014
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100