Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

jquery sortable save to database

$
0
0

Hello there,

i use jquery sortable to sort data from a database

<script src="https://code.jquery.com/jquery-1.12.4.js"></script><script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script><script type="text/javascript">$(document).ready(function () {$('#clueTable tbody').sortable().disableSelection();
    });</script><table id="clueTable" class="display">
<thead>
<tr>
<th>ID</th>
<th>x1</th>
<th>x2</th>
<th>Sort</th>
</tr>
</thead>

<tbody>
@foreach (var item in Model.Test.OrderBy(s => s.Sort))
{
<tr>
<td>@Html.DisplayFor(modelItem => item.ID)</td>
<td>@Html.DisplayFor(modelItem => item.x1)</td>
<td>@Html.DisplayFor(modelItem => item.x2)</td>
<td>@Html.DisplayFor(modelItem => item.Sort)</td>
</tr>
}
</tbody>
</table>

This works without any problems.
But now I want to write the sorting into the database field "Sort". Can someone tell me how I get that way?


Viewing all articles
Browse latest Browse all 9386

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>