Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Zing! It has been done. The problem was $(this).attr("id"). It needed to be $(ui.item).attr("id"). This returns the element being dragged, rather than the sortable container. Thank you SO much for all of your help.</p> <pre><code>&lt;%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage&lt;IEnumerable&lt;Draggable.Item&gt;&gt;" %&gt; &lt;asp:Content ContentPlaceHolderID="TitleContent" runat="server"&gt; Index &lt;/asp:Content&gt; &lt;asp:Content ContentPlaceHolderID="MainContent" runat="server"&gt; &lt;ul id="sortable1" class="connectedSortable"&gt; &lt;% foreach (var item in Model) { %&gt; &lt;% Html.RenderPartial("Item", item); %&gt; &lt;% } %&gt; &lt;/ul&gt; &lt;ul id="sortable2" class="connectedSortable"&gt; &lt;/ul&gt; &lt;/asp:Content&gt; &lt;asp:Content ContentPlaceHolderID="ScriptContent" runat="server"&gt; &lt;style type="text/css"&gt; #sortable1, #sortable2 { list-style-type: none; margin: 0; padding: 0; float: left; margin-right: 10px; } #sortable2 { height: 400px; width: 140px; background: #ccc; } #sortable1 li, #sortable2 li { margin: 0 5px 5px 5px; padding: 5px; font-size: 1.2em; width: 120px; } &lt;/style&gt; &lt;script type="text/javascript"&gt; $(function() { $("#sortable1").sortable({ connectWith: '.connectedSortable' }).disableSelection(); $("#sortable2").sortable({ connectWith: '.connectedSortable', receive: function(event, ui) { var colNum = $(ui.item).attr("id").replace(/col_/, ""); $.post("/Home/UpdateSortOrder", { columnNum: colNum, sectionIdQueryString: $(this).sortable("serialize") }); } }).disableSelection(); }); &lt;/script&gt; &lt;/asp:Content&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload