Getting JQuery UI Sortable to work on asp.net ListView items?
Posted
by Xaisoft
on Stack Overflow
See other posts from Stack Overflow
or by Xaisoft
Published on 2009-10-29T17:40:20Z
Indexed on
2010/04/16
19:03 UTC
Read the original article
Hit count: 188
I have the following ListView in which I am using the JQuery UI sortable function to be able to sort the items in the ListView. The problem is that I can't put a sortable class on the table in the ItemTemplate because it does not work, if I put a class="sortable" on the outer div, it works, but it allows me to sort everything within the ListView, I just want to be able to move sort the tables. Here is the markup
<div> //Works here, but hr's become sortable too.
<asp:ListView ID="lvwDocuments" runat="server">
<LayoutTemplate>
<h3>
Documents</h3>
<asp:PlaceHolder ID="itemPlaceHolder" runat="server">
</asp:PlaceHolder>
</LayoutTemplate>
<ItemTemplate>
<table class="sortable"> //Does not work Here
<tr>
<td>
<p class="title">
<a runat="server" href='<%#Eval("url") %>'>
<%#Eval("title") %></a></p>
<br />
<p>
<%#Eval("description") %></p>
</td>
</tr>
</table>
</ItemTemplate>
<ItemSeparatorTemplate>
<hr />
</ItemSeparatorTemplate>
</div>
Also, How can I preserve the sort order even after the page is refreshed.
© Stack Overflow or respective owner