我有两个 asp.net 列表框。我想使用拖放将项目从一个列表框移动到另一个。我尝试使用 j Query,但 dint 似乎有效。我还将我的列表框更改为 HTML 选择,但仍然相同。我试图添加按钮来做同样的事情。我的代码如下。任何帮助都感激不尽。
<script type="text/javascript">
$(function () {
$("#Setter, #Getter").sortable({
connectWith: ".sortable"
}).disableSelection();
});
$(document).ready(
function () {
$('#Selectone').click(
function (e) {
$('#Setter > option:selected').appendTo('#Getter');
e.preventDefault();
});
$('#SelectAll').click(
function (e) {
$('#Setter > option').appendTo('#Getter');
e.preventDefault();
});
$('#RemoveOne').click(
function (e) {
$('#Getter > option:selected').appendTo('#Setter');
e.preventDefault();
});
$('#RemoveAll').click(
function (e) {
$('#Getter > option').appendTo('#Setter');
e.preventDefault();
});
});
</script>
<select id="Setter" runat ="server" datasourceid="LinqDataSource1" class="sortable" multiple="true" draggable="true" datatextfield="Section" datavaluefield="Section" dropzone="Getter" size="30" > </select>
<asp:LinqDataSource ID="LinqDataSource1" runat="server" ContextTypeName="WebApplication1.insentraDataContext" EntityTypeName="" OrderBy="Section" Select="new (Section)" TableName="Sections">
</asp:LinqDataSource>
<asp:Button ID="Selectone" runat="server" Text=">" />
<asp:Button ID="SelectAll" runat="server" Text=">>" />
<asp:Button ID="RemoveOne" runat="server" Text="<" />
<asp:Button ID="RemoveAll" runat="server" Text="<<" />