Click here to Skip to main content
16,004,806 members
Please Sign up or sign in to vote.
2.33/5 (2 votes)
See more:
hi,
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.
Posted
Updated 6-Nov-13 17:39pm
v3
Comments
JoCodes 6-Nov-13 7:27am    
Drag and drop at runtime?Can you make it more clear?
Pratik Bhuva 6-Nov-13 7:51am    
Please clear your question.
We can't get idea what are you looking for.
is your Problem regarding to custom control of Asp.Net???
Raajkumar.b 6-Nov-13 7:56am    
yes
ZurdoDev 6-Nov-13 8:47am    
Have you searched for examples? Since you haven't provided any code of your own what do you expect us to give you?
Sergey Alexandrovich Kryukov 6-Nov-13 9:57am    
I think it still deserves some answer, just because there are different approaches. I answered, please see.
—SA

1 solution

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
 
Share this answer
 
v2
Comments
thatraja 6-Nov-13 10:57am    
I had an article in my bookmarks but don't know where's it. That's a perfect one for this question.
5!
Sergey Alexandrovich Kryukov 6-Nov-13 11:01am    
Thank you, Raja.
—SA
Raajkumar.b 6-Nov-13 23:35pm    
i think user control is not the way to do this. Its not the user control it is custom control.
Sergey Alexandrovich Kryukov 6-Nov-13 23:51pm    
Who told you about "user control"? And it makes no difference at all.
—SA
Raajkumar.b 6-Nov-13 23:55pm    
hi sergey am telling that my question is wrong.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900