是否有可能使用jQuery对GridView行进行排序?
问题描述:
我曾尝试通过以下方式来实现这一点:是否有可能使用jQuery对GridView行进行排序?
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>
这是我的母版的javascript:
$(document).ready(function() {
$(function() {
$(".sortable tbody").sortable();
$(".sortable tbody").disableSelection();
});
});
但是,这是行不通的。
关于如何使这项工作的任何想法?或者如果有可能呢?
答
为了解决这个问题,就需要有一个看看以下帖子:
http://www.isocra.com/2008/02/table-drag-and-drop-jquery-plugin/
这是关于最近jQuery插件,允许拖放表格元素。这对于GridViews很有用,因为浏览器将它呈现为一个表格。然而,这可能不足以得到解决问题的方法,因为它已经通过这篇文章,它与GridView的具体工作已经清楚地说明:
http://forums.asp.net/t/1684346.aspx/1?tableDnD+onDragClass+not+working+on+asp+net+GRIDVIEW
希望这有助于人同样的问题!
答
你应该下面的链接....
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/
给我评论,如果它可以帮助你.. !!!!!! – sikender
感谢您的回答。这导致我找到了这个问题的答案。我会尽快发布。干杯 – aleafonso