5
Answers

working on jquery datatable not showing table design

Rizwan Khral

Rizwan Khral

7y
292
1
Output

[{"EmpIdVm":1, "EmpNameVm":"Masror", "ExtentionVm":121, "EmailVm":"[email protected]", "OfficeIdVm":0,"ReportToVm":"Hr","JobTitleVm":"Engr",
"OfficeNameVm":".Net Tech"}, {"EmpIdVm":2, "EmpNameVm":"Waseem", "ExtentionVm":222, "EmailVm":"[email protected]","OfficeIdVm":0,"ReportToVm":"hr","JobTitleVm":"Engr",
"OfficeNameVm":".Net Tech"}]

i am workin with jquery datatable its not showing the datatable design just showing the json data like above output

Mvc controller code

  1. public JsonResult EmployeeDataTable(EmployeeViewModel vm)  
  2.         {  
  3.   
  4.             List list = db.EmployeeTables.Select(x => new EmployeeViewModel  
  5.             {  
  6.                 EmpIdVm = x.EmpId,  
  7.                 EmpNameVm = x.EmpName,  
  8.                 ExtentionVm = x.Extention,  
  9.                 EmailVm = x.Email,  
  10.                 OfficeNameVm = x.OfficeTable.OfficeName,  
  11.                 ReportToVm = x.ReportTo,  
  12.                 JobTitleVm = x.JobTitle  
  13.             }  
  14.                 ).ToList();  
  15.             return Json(list, JsonRequestBehavior.AllowGet);  
  16.               
  17.         } 


mvc view code

  1. @{  
  2.     ViewBag.Title = "EmployeeDataTable";  
  3. }  
  4.   
  5. <!-- Inject Script Filtered -->  
  6. "~/Content/DataTable/css/jquery.dataTables.css" rel="stylesheet" />  
  7. <!-- Inject Script Filtered -->  
  8. "~/Content/bootstrap.min.css" rel="stylesheet" />  
  9. EmployeeDataTable

      
  10.   
  11. class="container">  
  12.   
  13.     "MyDataTable">  
  14.           
  15.               
  16.                  ID   
  17.                  Name   
  18.                 Extention  
  19.                 Email  
  20.                 Office Name  
  21.                 Report To  
  22.                 Job Title  
  23.               
  24.           
  25.           
  26.       
  27.   
  
  •   
  • <!-- Inject Script Filtered --> 



  • Answers (5)