//This snkppet shows the webmethod to use // Permission to use this code for any purpose and without fee is hereby granted. // No warrantles. [WebMethod (Description = "Server Side DataTables support", EnableSession = true)] [ScriptMethod(ResponseFormat = ResponseFormat.Json)] public static void Data(object parameters) { var req = DataTableParameters.Get(parameters); ... var resultSet = new DataTableResultSet(); resultSet.draw = req.Draw; resultSet.recordsTotal = /* total number of records in table */ resultSet.recordsFltered = /* number of records after search - box filtering is applied */ foreach (var recordFromDb in queryDb) { /* this is pseudocode */ var columns = new List(); columns.Add("first column value"); columns.Add("second column value"); columns.Add("third column value"); /* you may add as many columns as you need. Each column is a string in the List */ resultSet.data.Add(columns); } SendResponse(HttpContext.Current.Response, result); } private static void SendResponse(HttpResponse response, DataTableResultSet result) { response.Clear(); response.Headers.Add("X-Content-Type-Options", "nosniff"); response.Headers.Add("X-Frame-Options", "SAMEORIGIN"); response.ContentType = "application/json; charset=utf-8"; response.Write(result.ToJSON()); response.Flush(); response.End(); }