Click here to Skip to main content
11,709,033 members (63,410 online)
Rate this: bad
good
Please Sign up or sign in to vote.
Hello,
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 19:27pm
Edited 24-Nov-11 18:37pm
v5
Comments
Sunasara Imdadhusen at 24-Nov-11 5:45am
   
Have you written any code for that?
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

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

CLICK HERE[^]

//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();
    
   
    $.ajax({
        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>"
                                        );
 
            }
            SetCssRule();
            
    );
        },
        error: OnError
    });
</tr>

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

Solution 3

i finally find the solution for this..and it works efficiently.. Smile | :)
//in .aspx page
<%@ Page Title="Home Page" Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs"
    Inherits="_Default" %>
 

<html>
<head>
<script src="js/jquery.js" type="text/javascript"></script>
  Permalink  
v6

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

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 580
1 Maciej Los 235
2 Peter Leow 219
3 OriginalGriff 214
4 Mika Wendelius 170
0 OriginalGriff 9,348
1 Sergey Alexandrovich Kryukov 8,727
2 CPallini 5,189
3 Maciej Los 4,991
4 Mika Wendelius 3,856


Advertise | Privacy | Mobile
Web04 | 2.8.150819.1 | Last Updated 19 Feb 2014
Copyright © CodeProject, 1999-2015
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