Click here to Skip to main content
15,881,882 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
JavaScript
function FillGrid() {
            debugger;
            var options;
                var data = { };
            var json_data = JSON.stringify(data);
            $.ajax({
                type: "POST",
                contentType: "application/json; charset=utf-8",
                url: "D2-1-1main.aspx/FillGridView",
                data: json_data,
                dataType: "json",
                success: function (data) {
                    $("[id*=dlCustomers]").attr("border", "1");
                    var row = $("[id*=dlCustomers] tr:last-child").clone(true);
                    $("[id*=dlCustomers] tr:last-child").remove();
                    $.each(data.d, function (key, value) {
                       
                        var customer = $(this);
                        $(".CustomerID", row).html(value.CustomerID);
                        $(".ContactName", row).html(value.ContactName);
                        $(".City", row).html(value.City);
                        $("[id*=dlCustomers]").append(row);
                        row = $("[id*=dlCustomers] tr:last-child").clone(true);
                        alert(row);
                    });
                },
                error: function (jqXHR, exception) {
                    alert(jqXHR.responseText);
                }
            });
            return false;
        }



ASP.NET
<asp:DataList ID="dlCustomers" runat="server" RepeatLayout="Table" BorderStyle="Solid" Width="99%" ForeColor="#000000"
                       BackColor="#ffffff"
                       CellPadding="3"
                       GridLines="none">
                       <ItemStyle Font-Names="tahoma,arial,sans-serif"
                           Font-Size="12"
                           BackColor="#ffffff" />
                       <AlternatingItemStyle Font-Names="tahoma,arial,sans-serif"
                           Font-Size="2"
                           BackColor="#ffff00" />
                       <ItemTemplate>
                           Customer Name:
                           <asp:Label ID="ContactName" CssClass="ContactName" runat="server" Text='<%# Eval("ContactName") %>'></asp:Label><br />
                           Customer ID:
                           <asp:Label ID="CustomerID" CssClass="CustomerID" runat="server" Text='<%# Eval("CustomerID") %>'></asp:Label>
                           City:
                           <asp:Label ID="Version" runat="server" CssClass="City" Text='<%# Eval("City")%>'></asp:Label>
                       </ItemTemplate>
                   </asp:DataList>



VB
<System.Web.Services.WebMethod(EnableSession:=True)> _
    Public Shared Function FillGridView() As Customersinfo()
        Dim dt As New DataTable()
        Dim objDll = New Clscust()
        Dim details As New List(Of Customersinfo)()
        Try
            details = objDll.GetCustInfo()
           

        Catch ex As Exception

        End Try
        Return details.ToArray()
    End Function




above code fill only two record
i'm not able to get the exact error
i'm getting 6 Records for details.ToArray() then it show Error after two records in jquery:ajax function
Posted
Updated 28-Nov-14 1:02am
v3
Comments
ZurdoDev 27-Nov-14 23:17pm    
What is your question?

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