Ticket Q527342
Visible to All Users

Drag Files from Windows Explorer to GridView

created 11 years ago

Hi,

I have a gridview that I use for capturing attachments, I would like to enable drag & drop so the user can drag messages from Outlook as well as files from Windows and drop onto the gridview.

I have enabled AllowDrop but I just get the 'No Entry' sign, I am unable to find any examples of how to do this .

Best Regards
Howard

Comments (2)

    Hello Howard,
    >>I would like to enable drag & drop so the user can drag messages from Outlook as well as files from Windows and drop onto the gridview.
    Would you please confirm if you are talking about the WinForms XtraGrid or ASP.NET ASPxGridView control?
    >>I have enabled AllowDrop but I just get the 'No Entry' sign
    Would you please illustrate your current progress with some screenshots, code files, etc.?

      Hi,
      This is referring to the WinForms GridView
      I have manged to get simple files from explorer to work, I had switched on Allow Drop but was working with the wrong event. I was trying to use the gridview Drag/Drop rather than the Grid Controller drag/drop.
      What I would kike to know now (if possible) is to be able to drag an outlook message from the InBox to the gridview. I looked at the data formats (e.dataGetFormats) and I didn't see one that looked like it would fit for mail messages.
      At the moment the users have to save the message onto the disk and then add via the openFile Dialog, now I have the file drag/drop working that would speed things up a little, so doing the whole drag/drop in one go would be great.
      Thanks
      Howard

      Answers approved by DevExpress Support

      created 11 years ago (modified 11 years ago)

      Hi Howard,
      Yes, you are right. To accomplish the task, it is necessary to handle the GridControl.DragDrop event. The dragged data can be obtained from the DragEventArgs.Data property. In fact, this task is not directly related to our components. The DragDrop event is raised for the GridControl's parent class - Control. The DragEventArgs.Data property returns an instance which implements the IDataObject interface. To retrieve data from this object, you can use the GetData method.
      To retrieve the dragged message information in the String format, you can pass the
      DataFormats.Text or the DataFormats.UnicodeText value as the first parameter of this method (the standard Windows ANSI and Unicode text formats correspondingly).
      I have also searched for more information on the Internet and found this article, which describes the common approaches of solving this task:Outlook Drag and Drop in C#. I believe that it will be useful to you.
      Feel free to contact us if you have further difficulties. We are happy to help you at any time.

        Show previous comments (2)
        B B
        Brendon Muck [DevExpress MVP] 11 years ago
          B B
          Brendon Muck [DevExpress MVP] 11 years ago

            There's no built-in drag/drop support in the ASP.NET controls. You'd need to implement your own with jQuery or HTML5.

            DevExpress Support Team 11 years ago

              Hi Michael,
              I have moved your question to the separate How to drag and drop of files from explorer/outlook to a ASPxGridView ticket created on your behalf. I also passed it to our ASP support team. Please refer to that ticket.

              Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

              Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.