Hello I am trying to display data using jQuery DataTables and my pagination is displaying vertically. Here is the code
<head>
<link href="https://cdn.datatables.net/1.11.5/css/jquery.dataTables.min.css" rel="stylesheet" />
<script src="https://code.jquery.com/jquery-3.5.1.js"></script>
<script src="https://cdn.datatables.net/1.11.5/js/jquery.dataTables.min.js"></script>
<script type="text/javascript">
$(document).ready(function () {
$('#dtUsers').DataTable({
"ajax": "../api/GetActiveMembers/GetData",
"columns": [
//{ "data": "UserId" },
{ "data": "FirstName" },
{ "data": "LastName" },
{ "data": "Email" },
{ "data": "UserRole" },
{ "data": "Organization" },
{ "data": "LastLoginDate" },
{ "data": "ButtonData" }
]
});
});
</script>
<title>View Active Users</title>
</head>
<body>
<div id="divTable" runat="server" visible="true">
<div class="myDiv">
<h1 class="mb-1">Active Users</h1>
</div>
<table id="dtUsers" class="table table-condensed table-bordered table-striped">
<thead>
<tr>
<%--<th>User ID</th>--%>
<th>First Name</th>
<th>Last Name</th>
<th>Email</th>
<th>Role</th>
<th>Organization</th>
<th>Last Login</th>
<th></th>
</tr>
</thead>
</table>
</div>
</body>
I am also attaching an image of how it is looking right now
Can someone please tell me how I can fix this? I cannot find anything like this online.
Edit: This is how it should look like
THanks
3
Answers
This did the trick. Thank you all
Quick Solution (If I understood correctly)
Would it not be easier to use a listview, or gridview? They both support paging, and are quite easy.
Say this markup:
And then our code:
And we get this:
Now, I did grab a css format for the pager – can’t remember where, but I have this:
But, this css was used for the pager: