【问题标题】:Drag and Drop DataGrid拖放数据网格
【发布时间】:2013-07-15 01:27:00
【问题描述】:

如何在 C# ASP.net 中创建 DataGrid,以便您可以拖放行以重新排序。我想使用工具箱中的实际 DataGrid 工具,而不是相似的。

【问题讨论】:

  • 我不认为DataGrid 控件具有开箱即用的功能。您可能可以在客户端使用 jQuery UI Draggable 对视图中的行进行重新排序,但这不会影响服务器端实际数据中的任何内容,除非您向服务器端处理程序发送某种更新(例如 AJAX 调用)。

标签: c# asp.net datagrid


【解决方案1】:

HERE 是演示!

正如大卫所说,您可以使用 JQuery 来拖放 DataGrid' Rows !

 <script type="text/javascript">
$(function () {
    $(".drag_drop_grid").sortable({
        items: 'tr:not(tr:first-child)',
        cursor: 'crosshair',
        connectWith: '.drag_drop_grid',
        axis: 'y',
        dropOnEmpty: true,
        receive: function (e, ui) {
            $(this).find("tbody").append(ui.item);
        }
    });
    $("[id*=gvDest] tr:not(tr:first-child)").remove();
});

您可以找到完整的参考资料HERE :)
祝你好运!

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-06-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-08-23
    相关资源
    最近更新 更多