Hi sanjay8090,
Refer below sample.
And refer below link to resolve your error.
HTML
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function () {
$('#btn').on('click', function () {
$.ajax({
type: 'Post',
url: "CS.aspx/Employee",
contentType: "application/json; charset=utf-8",
success: function (response) {
employees = JSON.parse(response.d);
var tr;
for (var i = 0; i < employees.length; i++) {
tr = $('<tr/>');
tr.append("<td>" + employees[i].Id + "</td>");
tr.append("<td>" + employees[i].Name + "</td>");
tr.append("<td>" + employees[i].Address + "</td>");
tr.append("<td>" + employees[i].Phone + "</td>");
tr.append("<td>" + employees[i].Email + "</td>");
tr.append("<td>" + employees[i].Project + "</td>");
tr.append("<td>" + employees[i].Role + "</td>");
tr.append("<td>" + employees[i].Status + "</td>");
tr.append("<td>" + employees[i].Completion + "</td>");
$('#tbl').append(tr);
$('tr')
}
},
error: function (errorThrown) {
debugger;
alert(errorThrown);
}
});
});
});
</script>
</head>
<body>
<form id="form1" runat="server">
<center>
<input type="button" id="btn" value="Get Data" />
<div>
<table id="tbl">
<tr>
<th>
Id
</th>
<th>
Name
</th>
<th>
Address
</th>
<th>
Phone
</th>
<th>
Email
</th>
<th>
Project
</th>
<th>
Role
</th>
<th>
Status
</th>
<th>
Completion
</th>
</tr>
</table>
</div>
</center>
</form>
</body>
</html>
Namespaces
C#
using System.Data;
using Newtonsoft.Json;
using System.Web.Services;
VB.Net
Imports System.Data
Imports Newtonsoft.Json
Imports System.Web.Services
Code
C#
[WebMethod]
public static string Employee()
{
DataTable dt = new DataTable();
dt.Columns.AddRange(new DataColumn[9] {
new DataColumn("Id", typeof(int)),
new DataColumn("Name", typeof(string)),
new DataColumn("Address",typeof(string)),
new DataColumn ("Phone",typeof(string)),
new DataColumn ("Email", typeof(string)),
new DataColumn ("Project", typeof(string)),
new DataColumn("Role",typeof(string)),
new DataColumn ("Status",typeof(string)),
new DataColumn("Completion",typeof(string))
});
for (int i = 0; i < 1000; i++)
{
dt.Rows.Add(i, "Ashok We've also got a Draw counter. This is important, because DataTables ke var j = 1;eps a count of the number of times it 00redraws the table. Every time you interact with thej++table, DataTables fetches the data again from the server. It also increments that counter. When the call comes back with the data, the Draw parameter needs to be there with that same value or we'll get an error. You can read more about the parameters here: DataTables: Server Side", "Faridabad We've also got a Draw counter. This is important, because DataTables keeps a count of the number of times it redraws the table. Every time you interact with the table, DataTables fetches the data again from the server. It also increments that counter. When the call comes back with the data, the Draw parameter needs to be there with that same value or we'll get an error. You can read more about the parameters here: DataTables: Server Side", "0654546644 We've also got a Draw counter. This is important, because DataTables keeps a count of the number of times it redraws the table. Every time you interact with the table, DataTables fetches the data again from the server. It also increments that counter. When the call comes back with the data, the Draw parameter needs to be there with that same value or we'll get an error. You can read more about the parameters here: DataTables: Server Side", "ashok@gmail.com We've also got a Draw counter. This is important, because DataTables keeps a count of the number of times it redraws the table. Every time you interact with the table, DataTables fetches the data again from the server. It also increments that counter. When the call comes back with the data, the Draw parameter needs to be there with that same value or we'll get an error. You can read more about the parameters here: DataTables: Server Side", "Signage We've also got a Draw counter. This is important, because DataTables keeps a count of the number of times it redraws the table. Every time you interact with the table, DataTables fetches the data again from the server. It also increments that counter. When the call comes back with the data, the Draw parameter needs to be there with that same value or we'll get an error. You can read more about the parameters here: DataTables: Server Side", "Devloper We've also got a Draw counter. This is important, because DataTables keeps a count of the number of times it redraws the table. Every time you interact with the table, DataTables fetches the data again from the server. It also increments that counter. When the call comes back with the data, the Draw parameter needs to be there with that same value or we'll get an error. You can read more about the parameters here: DataTables: Server Side", "Progress We've also got a Draw counter. This is important, because DataTables keeps a count of the number of times it redraws the table. Every time you interact with the table, DataTables fetches the data again from the server. It also increments that counter. When the call comes back with the data, the Draw parameter needs to be there with that same value or we'll get an error. You can read more about the parameters here: DataTables: Server Side", "02/12/2019 We've also got a Draw counter. This is important, because DataTables keeps a count of the number of times it redraws the table. Every time you interact with the table, DataTables fetches the data again from the server. It also increments that counter. When the call comes back with the data, the Draw parameter needs to be there with that same value or we'll get an error. You can read more about the parameters here: DataTables: Server Side");
}
var splitdata = dt.AsEnumerable().CopyToDataTable();
return JsonConvert.SerializeObject(splitdata);
}
VB.Net
<WebMethod()>
Public Shared Function Employee() As String
Dim dt As DataTable = New DataTable()
dt.Columns.AddRange(New DataColumn(8) {New DataColumn("Id", GetType(Integer)), New DataColumn("Name", GetType(String)), New DataColumn("Address", GetType(String)), New DataColumn("Phone", GetType(String)), New DataColumn("Email", GetType(String)), New DataColumn("Project", GetType(String)), New DataColumn("Role", GetType(String)), New DataColumn("Status", GetType(String)), New DataColumn("Completion", GetType(String))})
For i As Integer = 0 To 1000 - 1
dt.Rows.Add(i, "Ashok We've also got a Draw counter. This is important, because DataTables ke var j = 1;eps a count of the number of times it 00redraws the table. Every time you interact with thej++table, DataTables fetches the data again from the server. It also increments that counter. When the call comes back with the data, the Draw parameter needs to be there with that same value or we'll get an error. You can read more about the parameters here: DataTables: Server Side", "Faridabad We've also got a Draw counter. This is important, because DataTables keeps a count of the number of times it redraws the table. Every time you interact with the table, DataTables fetches the data again from the server. It also increments that counter. When the call comes back with the data, the Draw parameter needs to be there with that same value or we'll get an error. You can read more about the parameters here: DataTables: Server Side", "0654546644 We've also got a Draw counter. This is important, because DataTables keeps a count of the number of times it redraws the table. Every time you interact with the table, DataTables fetches the data again from the server. It also increments that counter. When the call comes back with the data, the Draw parameter needs to be there with that same value or we'll get an error. You can read more about the parameters here: DataTables: Server Side", "ashok@gmail.com We've also got a Draw counter. This is important, because DataTables keeps a count of the number of times it redraws the table. Every time you interact with the table, DataTables fetches the data again from the server. It also increments that counter. When the call comes back with the data, the Draw parameter needs to be there with that same value or we'll get an error. You can read more about the parameters here: DataTables: Server Side", "Signage We've also got a Draw counter. This is important, because DataTables keeps a count of the number of times it redraws the table. Every time you interact with the table, DataTables fetches the data again from the server. It also increments that counter. When the call comes back with the data, the Draw parameter needs to be there with that same value or we'll get an error. You can read more about the parameters here: DataTables: Server Side", "Devloper We've also got a Draw counter. This is important, because DataTables keeps a count of the number of times it redraws the table. Every time you interact with the table, DataTables fetches the data again from the server. It also increments that counter. When the call comes back with the data, the Draw parameter needs to be there with that same value or we'll get an error. You can read more about the parameters here: DataTables: Server Side", "Progress We've also got a Draw counter. This is important, because DataTables keeps a count of the number of times it redraws the table. Every time you interact with the table, DataTables fetches the data again from the server. It also increments that counter. When the call comes back with the data, the Draw parameter needs to be there with that same value or we'll get an error. You can read more about the parameters here: DataTables: Server Side", "02/12/2019 We've also got a Draw counter. This is important, because DataTables keeps a count of the number of times it redraws the table. Every time you interact with the table, DataTables fetches the data again from the server. It also increments that counter. When the call comes back with the data, the Draw parameter needs to be there with that same value or we'll get an error. You can read more about the parameters here: DataTables: Server Side")
Next
Dim splitdata = dt.AsEnumerable().CopyToDataTable()
Return JsonConvert.SerializeObject(splitdata)
End Function