用于在asp.net中拖放用户控件的代码 [英] code for drag and drop user controls in asp.net

查看:81
本文介绍了用于在asp.net中拖放用户控件的代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我有一个带圆圈的用户控件。现在我想在运行时将该圆圈拖放到面板中。帮助我任何一个





这里有一个关于我的要求的例子



在网上购物网站,我们将选择一个产品并移动购物篮。我需要这个拖动代码这里的圆圈是一个产品,面板是一个篮子。



主要要求是圆圈应该放在面板中,而不是在页面中的任何位置。


i have a user control with a circle in it. Now i want to drag and drop that circle in panel at runtime. help me any one


here is an example about my requirement

In online shopping website there we will select a product and move it shopping basket. I need this dragging code here circle is a product and panel is a basket.

main requirement is circle should be drop in panel only not any where in page.

推荐答案

首先,您可以使用新的HTML5功能来启用拖放行为:

http://www.w3schools.com/html/html5_draganddrop.asp [ ^ ],

http://www.html5rocks.com/en/tutorials/dnd/basics/ [ ^ ],

http://www.tutorialspoint.com/html5/html5_drag_drop.htm [ ^ ]。



当然,这可以在没有HTML5功能的情况下实现,因为处理可用的原始鼠标事件应该足以实现这种行为。这个简单的代码示例将为您提供一个好主意:

http ://luke.breuer.com/tutorial/javascript-drag-and-drop-tutorial.aspx [ ^ ]。



当然jQuery非常有用。注意jQuery UI .draggable()/。droppable() 交互

http://jqueryui.com/draggable/ [ ^ ],

http://jqueryui.com/droppable/ [ ^ ](请参阅此处的代码示例),

http://jqueryui.com [ ^ ]。



代码示例可在上面引用的文章中找到。



如果您需要学习jQuery(强烈推荐),请参阅:

http:// en .wikipedia.org / wiki / JQuery [ ^ ] ,

http:// j query.com [ ^ ],

< a href =http://learn.jquery.com/> http://learn.jquery.com [ ^ ],

http:// learn.jquery.com/using-jquery-core [ ^ ],

http://learn.jquery。 com / about-jquery / how-jquery-works [ ^ ](从这里开始)。



请记住,jQuery在设计时考虑了兼容性。



-SA
First of all, you can use new HTML5 features to enable drag and drop behavior:
http://www.w3schools.com/html/html5_draganddrop.asp[^],
http://www.html5rocks.com/en/tutorials/dnd/basics/[^],
http://www.tutorialspoint.com/html5/html5_drag_drop.htm[^].

And of course this is possible to implement without HTML5 features, as handling available raw mouse events should be enough for implementation of such behavior. This simple code sample will give you a good idea:
http://luke.breuer.com/tutorial/javascript-drag-and-drop-tutorial.aspx[^].

And of course jQuery can be very helpful. Pay attention for jQuery UI .draggable()/.droppable() interactions:
http://jqueryui.com/draggable/[^],
http://jqueryui.com/droppable/[^] (see code sample here),
http://jqueryui.com[^].

The code samples are available in the articles referenced above.

If you need to learn jQuery (highly recommended), please see:
http://en.wikipedia.org/wiki/JQuery[^],
http://jquery.com[^],
http://learn.jquery.com[^],
http://learn.jquery.com/using-jquery-core[^],
http://learn.jquery.com/about-jquery/how-jquery-works[^] (start from here).

Remember that jQuery is designed with compatibility in mind.

—SA


这篇关于用于在asp.net中拖放用户控件的代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆