Hello,
I have developed an application that uploads pdf files to the server. each file is correlated with a particular row of a datagridview.
In datagridview a column shows, for each row, an icon if the row has an attached file.
It works perfectly (see attached image).
To upload the file using the upload component, you need to browse the PC folder to select the file to attach.
Wonder if it is possible to do this with the drag and drop functionality.
The idea is to drag the file from the PC window (eg Desktop or any folder), drag it to a datagridviewcell and get the event necessary to manage the upload code.
in other words like when I attach an image in this chat, by dragging and dropping on “choose file”.
I hope I have clearly explained my idea.
Thanks for any suggestions
Hi Angelo,
In addition to Luca’s answer, I’ve prepared a small sample project you can try using the DragDrop feature.
Please let me know if you have any questions or this isn’t clear!
Best regards,
Levie
I have a similar question, I have a list view and I want to upload a file with the drag and drop, I have checked the Levi’s sample project but I still don’t know how to save the file, all I could do is get the file name(not the full path), and I wanted to convert the dragged file into a byte array, I hope it is possible to do so.
Thanks in advance!
Thanks for the quick reply.
That’s exactly what I need.
Cheers
Angelo
Wisej supports dropping files on any control. Don’t even need the Upload control. Just set AllowDrop=true and handle the drag drop events like in winforms. You can also check the file names or types being dragged. The information is limited by the browser.
https://stackoverflow.com/questions/68598/how-do-i-drag-and-drop-files-into-an-application
Please login first to submit.