Click here to Skip to main content
15,893,381 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello all,

I am using jquery datatable and try to call function in jquery datatable from aspx page but cannot be able to bind datatable from that function .

Please help..

Following is my jquery Code
JavaScript
$(document).ready(function () {
    if ($.fn.dataTable.isDataTable('#example')) {
        t.destroy();
    }
    t = $("#example").DataTable({
        processing: true,
        serverSide: true,
        info: true,
        paging: true,
         searching: true,
        ajax: {
            url: 'Search.aspx/BindDatatable',
            data: function (data) {
               delete data.columns;
            }
        },
        columns: [
                { "data": "LibCode" },
                { "data": "LibName" },
                {
                    "render": function (data, type, full, meta) {
                        return '<a class="btn btn-warning" onClick="editdata(' + full.LibCode + ',\'' + full.LibCode + '\',\'' + full.LibCode + '\',\'' + full.LibCode + '\',\'' + full.LibCode + '\',\'' + full.LibCode + '\')" href="javascript://">Edit</a>&nbsp;&nbsp;<a class="btn btn-danger" onClick="deletePhantom(' + full.LibCode + ',\'DELETE\')" href="javascript://">Remove</a>';
                    }
                }
    ],
        order: [[0, 'desc']],
        select: true,
        dom: 'lfrtip',
        responsive: true,
        buttons: true
    });
    t.on('order.dt search.dt', function () {
        t.column(0, { search: 'applied', order: 'applied' }).nodes().each(function (cell, i) {
            cell.innerHTML = i + 1;
        });
    }).draw();
 });

and My aspx function is
C#
[System.Web.Script.Services.ScriptMethod(), System.Web.Services.WebMethod()]
public static List<LibDetails> BindDatatable()
{
	return PopulateCombo.BindDatatable();
}


What I have tried:

Please send any other code for jquery datatable with search and paging option
Posted
v2
Comments
Please debug and see where is the issue exactly. That way you can learn and implement.
Nigam,Ashish 28-Apr-16 9:46am    
what problem you are getting?
Member 8232678 29-Apr-16 0:11am    
Can;t be able to dubug function

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