Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
90
Drag and drop in a web form with a listview
posted

Hey Guys,

     Hopefully you can help me figure this out. I'm working in VS 2008.  I'm creating a web form with a listview that takes a datatable as a datasource.  The datatable adds images to the listview.

What I need to do is to be able to drag an image onto a div which is acting as my drop target.  Then, the user should be able to drag any image from the drop target onto a garbage can icon and remove it from the drop target.  Every time an image is dropped onto the drop target, or dragged off for removal, a hidden field will be updated with the file ids for use in saving them in a folder elsewhere.

Parts of it are working. For example I can drag an image onto the target area, and it gets added to the list in the hidden input. But, if I try to drag it over second div acting as my garbage collection drop area, I get a ghost image of the entire drop target moving with my mouse.

I believe the images should be wrapped in individual divs to correct that. My problem is that I have just started working with drag and drop and my javascript experience doesn't cover anything like this.

Any really good, basic examples you know of that would help me out here?

I can figure out how to update the list of images, etc. I need a better handle on the drag and drop part.

Thanks in advance

 

Parents
No Data
Reply Children
No Data