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
- public JsonResult EmployeeDataTable(EmployeeViewModel vm)
- {
-
- List list = db.EmployeeTables.Select(x => new EmployeeViewModel
- {
- EmpIdVm = x.EmpId,
- EmpNameVm = x.EmpName,
- ExtentionVm = x.Extention,
- EmailVm = x.Email,
- OfficeNameVm = x.OfficeTable.OfficeName,
- ReportToVm = x.ReportTo,
- JobTitleVm = x.JobTitle
- }
- ).ToList();
- return Json(list, JsonRequestBehavior.AllowGet);
-
- }
mvc view code
- @{
- ViewBag.Title = "EmployeeDataTable";
- }
-
- <!-- Inject Script Filtered -->
- "~/Content/DataTable/css/jquery.dataTables.css" rel="stylesheet" />
- <!-- Inject Script Filtered -->
- "~/Content/bootstrap.min.css" rel="stylesheet" />
EmployeeDataTable
-
class
="container"> -
- >
-
-
- ID
- Name
- Extention
- Email
- Office Name
- Report To
- Job Title
-
-
-
-
-
<!-- Inject Script Filtered -->