如何使listview项拖放 [英] How to make listview item drag and drop
问题描述
大家好,我正在研究.net中的一个项目。需要使用动态控件创建动态表单。就像Visual Studio中的Toolbox一样,我想用asp.net中的拖放功能创建一个带有Label,Literal,Checkbox等基本控件的工具箱。可以从工具箱拖动控件,可以放在窗体的右侧,可以创建动态窗体。请各位建议我如何实现它。
提前致谢。
我是什么尝试过:
我可以通过onclick listview项目移动listview项目,但我必须拖放。
Hello everyone, i am working on a project in .net. There is need to create Dynamic form with Dynamic Controls. Like Toolbox in visual studio i want to create a toolbox with basic controls like Label, Literal, Checkbox etc with drag and drop functionality in asp.net. one can drag the control from the toolbox and can drop at the right side of the form and can create dynamic form. Please guys suggest me how to achieve it.
Thanks in advance.
What I have tried:
I am able to move listview items by onclick of listview items but i have to drag and drop.
推荐答案
这不是一件容易的事,除非客户端脚本是您的专业领域。
拖放功能是客户端的事情。这意味着您需要使用JavaScript
来执行此操作。您可以查找具有拖放功能的JavaScript
库,这样您就可以省时间滚动自己的JavaScript
从头开始的代码。一个例子是使用jQuery
拖放式UI功能: Draggable | jQuery UI [ ^ ]和droppable:可信的| jQuery UI [ ^ ]
这是我发现的一个使用jQuery来启用ListView中的拖放: 使用jQuery拖放ListView项目
Well it's not an easy task to do, not unless if client-side scripting is your area of expertise.
The "drag-and-drop" feature is a client-side thing. This means that you would need to useJavaScript
to perform that. You can look for aJavaScript
library that has drag-and-drop feature so you'll save your time rolling your ownJavaScript
code from scratch. One example is usingjQuery
drag-drop UI feature: Draggable | jQuery UI[^] and droppable: Droppable | jQuery UI[^]
Here's one I found that uses jQuery to enable drag-and drop in ListView: Drag and drop ListView item using jQuery
这篇关于如何使listview项拖放的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!