ASP.NET - jquery ui connected sortable save to database -
okay have jquery ui connected sortable on page. works good. being dynamically created database. using asp repeater populate ul. works great. need save updated lists database. has proved difficult.
$(function () { $("#include, #exclude").sortable({ connectwith: ".connectedsortable", droponempty: true, }); $("#include, #exclude").disableselection(); });
this have jquery. think there may need more here, cannot seem figure out is. have found way loop through repeater items , them databoundliteralcontrol, every time uses old order , not new order.
any appreciated.
$("#sortable1 li").each(function (idx, li) { var idinputs = $(li).children(".id"); var nameinputs = $(li).children(".name");//if itemname input used $(idinputs).attr("id", "items_" + idx + "__itemid"); $(idinputs).attr("name", "items[" + idx + "].itemid"); //if itemname input used $(nameinputs).attr("id", "items_" + idx + "__itemname"); $(nameinputs).attr("name", "items[" + idx + "].itemname"); });
see link : http://jgibson.com/?p=59