TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Eswar Datta
NA
115
7.4k
Jquery DataTable in MVc
Jun 21 2018 2:28 AM
Jquery Datatable in MVC
This is my controller Action
Controller Action
public ActionResult Retrieving()
{
var data= db.retrieve();
return Json(new { data = data },JsonRequestBehavior.AllowGet);
}
Iam trying to call this method using jquery datatable
This is my view page and i wrote jquery code and also placed jquery
plugins.
@{
ViewBag.Title = "RetrievingSwAssets";
Layout = "~/Views/Shared/_Admin.cshtml";
}
<h2>RetrievingSwAssets</h2>
//table
<table id="RetrievingSwAst">
<thead>
<tr>AssetsId</tr>
<tr>AMSSW_AssetName</tr>
<tr>AssetType</tr>
<tr>Vendor</tr>
<tr>Version</tr>
<tr>DoP</tr>
<tr>Location</tr>
</thead>
</table>
datatable links
<link href="//cdn.datatables.net/1.10.9/css/jquery.dataTables.min.css"
rel="stylesheet" />
jquery datatable links
@section Scripts{
<script src="//cdn.datatables.net/1.10.9/js/jquery.dataTables.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular-datatables/2.1.0/angular-datatables.directive.js"></script>
<script src="~/Scripts/angular.min.js"></script>
<script>
$(document).ready(function () {
$('#RetrievingSwAst').DataTable({
"ajax": {
//path
"url": "/Admin/Retrieving",
"type": "GET",
"datatype": "json"
},
"columns": [
{ "data": "AssetID", "autoWidth": true },
{ "data": "AMSSW_AssetName", "autoWidth": true },
{ "data": "AMSSW_AssetType", "autoWidth": true },
{ "data": "AMSSW_Vendor", "autoWidth": true },
{ "data": "AMSSW_Version", "autoWidth": true },
{ "data": "Date_of_purchase", "autoWidth": true },
{ "data": "CompanyLocation", "autoWidth": true },
]
});
});
</script>
}
But Its Retrieving json format.
Like:{"data":[{"AssetID":"SW-Asset-
1","AMSSW_AssetName":null,"AMSSW_AssetType":"Software Asset","AMSSW_Vendor":null,"AMSSW_Version":null,"Date_of_purchase":null,"CompanyLocation":null},{"AssetID":"SW-Asset-2","AMSSW_AssetName":null,"AMSSW_AssetType":"Software Asset","AMSSW_Vendor":null,"AMSSW_Version":null,"Date_of_purchase":null,"CompanyLocation":null},{"AssetID":"SW-Asset-3","AMSSW_AssetName":"VisualStudio 2017","AMSSW_AssetType":"Software Asset","AMSSW_Vendor":"Micrsoft","AMSSW_Version":"15.2","Date_of_purchase":"2018-06-13","CompanyLocation":"hyd"}]}
I want to display this data in Table format
I don't no where the mistake. Plz solve it...
Reply
Answers (
2
)
From where to start to implement this grid
Any Methods for the sound increase or Decrease in scanning