Is it possible to drag and drop GridView rows with jQuery sortable?
I have tried to implement this in the following way:
GridView:
<asp:GridView ID="GridViewUnavailableDestination" runat="server" Visible="False"
Width="98%" AutoGenerateColumns="False" CellPadding="4" ForeColor="#333333"
GridLines="None" CssClass="sortable">
<Columns>
<asp:TemplateField HeaderText="Name">
<ItemTemplate>
<asp:Label ID="idUnavailable" runat="server" Text='<%# bind("idUnavailable") %>' Visible="false"></asp:Label>
<asp:Label Visible="true" runat="server" ID="unavailableLabel" Text='<%# bind("name") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Type">
<ItemTemplate>
<asp:Label Visible="true" runat="server" ID="unavailableTypeLabel" Text='<%# bind("type") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="RT">
<ItemTemplate>
<asp:Label Visible="true" runat="server" ID="unavailableRTLabel" Text='<%# bind("ringingTime") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
And this is my javascript in the MasterPage:
$(document).ready(function () {
$(function () {
$(".sortable tbody").sortable();
$(".sortable tbody").disableSelection();
});
});
However, it does not work.
Any i开发者_开发问答deas on how to make this work? Or if it is possible at all?
you should below links....
http://www.isocra.com/2008/02/table-drag-and-drop-jquery-plugin/
http://www.pedrera.com/blog/asp-net-listview-drag-and-drop-reordering-using-jquery/
http://www.codeproject.com/KB/webforms/DragAndDropGridView.aspx
http://www.foliotek.com/devblog/make-table-rows-sortable-using-jquery-ui-sortable/
To solve this issue, it is required to have a look at the following post:
http://www.isocra.com/2008/02/table-drag-and-drop-jquery-plugin/
It is about a recent jQuery plugin that allows to Drag and Drop table elements. This is useful for GridViews since the browser renders it as a table. However, this might not be enough to get the solution to the problem, as it has been clearly described by this post, which works with GridViews specifically:
http://forums.asp.net/t/1684346.aspx/1?tableDnD+onDragClass+not+working+on+asp+net+GRIDVIEW
Hope this helps people with the same issue!
精彩评论