I have a ASP.NET MVC 4 application using Bootstrap JavaScript and datatables to populate a list of transactions on a main page and have a link to a detail information of each transaction from the main page. Also pagination is used to page through the long list of transactions on the main page. All this works fine but when I browse to say like page 80 and click on one of the detail transaction on the main page and hit the return to transaction button on the details page I get returned to the 1st page of the main transactions instead of page 80 where I hit the entry to view details of that transaction. Is there a way to capture the current state of the pagination and return that from my return to main transactions button? Here is the ASP.NET.CSHTML view for the view history.
enter code here
@{
ViewBag.Title = "Purchase Order History";
}
@Html.Partial("_datatables")
<div class="panel panel-primary">
<div class="panel-heading panel-title">
<h4>
Purchase Order History
</h4>
</div>
<div class="table-responsive" style="overflow: auto; width: 100%;">
<table id="myTable" style="table-layout:fixed" class="table-striped">
<thead>
<tr>
<th>Ref. No.</th>
<th>Client</th>
<th>PO Num</th>
<th>Status</th>
<th></th>
</tr>
</thead>
<tbody></tbody>
</table>
</div>
</div>
<script>
$(document).ready(function() {
$('#myTable').dataTable({
"bServerSide": true,
"sAjaxSource": "AjaxHandler",
"bProcessing": true,
"order": [[0, "desc"]],
"aoColumnDefs": [
{
"aTargets": [4],
"mRender": function (data, type, row) {
return '<div class="btn-group btn-group">' +
'<a class="btn btn-default" href="Details?refNum=' + row[0] + '">' +
'<i class="fa fa-info-circle"></i><span class="sr-only">Details</span>' +
'</a>' +
'<a class="btn btn-default" href="Download?refNum=' + row[0] + '">' +
'<i class="fa fa-download"></i><span class="sr-only">Download</span>' +
'</a>';
}
}
]
});
});
</script>
Here is the button that returns you back to the main page
<div class="btn-group btn-group-lg">
<a class="btn btn-default" href="@Url.Action("ViewHistory")">
<i class="fa fa-arrow-left"></i>
<span class="sr-only">Index</span>
</a>
Any help with this would be really really appreciated.
Thanks so much !!!!!