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
Ramco Ramco
442
3.4k
516.9k
Paging In Datatable
May 28 2021 4:30 AM
Hi
How to do Paging in Jquery DataTable. In the below Method it will display all records from the Database.
Suppose there are 14 records & 5 records per page setting. I want that is should bring 1-5 records . If user clicks on 3 them 11-14 records should be displayed.
public
ActionResult Index()
{
return
View();
}
@model IEnumerable<MyApplication.Models.Location>
<!DOCTYPE html>
<html>
<head>
<meta name=
"viewport"
content=
"width=device-width"
/>
<title>Index</title>
</head>
<body>
<p>
</p>
<table
class
=
"table"
id=
"tblLocation"
>
<tr>
<th>
@Html.DisplayNameFor(model => model.Description)
</th>
<th></th>
</tr>
@foreach (
var
item
in
Model)
{
<tr>
<td>
@Html.DisplayFor(modelItem => item.Description)
</td>
<td></td>
</tr>
}
</table>
</body>
</html>
<script src=
"~/Scripts/Appjs/Location.js"
></script>
********************************************
$(document).ready(
function
() {
//$('#dataTable').DataTable();
$(
"#tblLocation"
).dataTable({
ajax: {
type:
"get"
,
url:
"/Location/List"
,
dataType:
"json"
,
dataSrc:
""
},
columns: [
{
data:
"Id"
,
visible:
false
},
{
data:
"Description"
},
{
data:
"LocationId"
,
render:
function
(data) {
return
"<button class='btnEdit btn btn-primary'data-LocationId="
+ data +
">Edit</button>"
;
}
},
{
data:
"PostId"
,
render:
function
(data) {
return
"<button class='btnDelete btn btn-danger' data-LocationId="
+ data +
">Delete</button>"
;
}
}
]
});
});
Thanks
Reply
Answers (
4
)
Query string URL in aap.net core
Hide Or Encrypt Query string in URL.