Multiple file drag and drop not working when Windows Forms Control is embeded in Web Page.

Hi all,

I am having a winodows forms control (windows control library) which is having a list view control on to which I will drag and drop the files and the control holds their names along with the path. It is working fine when I am executing it in VS2005. I am able to drag and drop single file or multiple files at a time. But, when I am embeding it into a web page using <object> tab, I am able to drag drop only single file at a time, it is not allowing me to drag and drop multiple files at a single go. any body have any clue?

my web page code:

<object id="myName" classid="http:WindowsControlLibrary1.dll#WindowsControlLibrary1.UserControl1"
height="870" width="1250" align="left" name="myCtrl" />
</object>

my dll code is here:

private void listView1_DragDrop(object sender, DragEventArgs e)
{
if(e.Data.GetDataPresent(System.Windows.Forms.DataFormats.FileDrop))
{
string[] files =(string[])e.Data.GetData(System.Windows.Forms.DataFormats.FileDrop);
try
{
foreach (string s in files)
{
listView1.Items.Add(s.ToString());
}
}
catch (System.Exception ex)
{
System.Windows.Forms.MessageBox.Show(ex.Message);
return;
}

}
}

private void listView1_DragEnter(object sender, DragEventArgs e)
{
if (e.Data.GetDataPresent(System.Windows.Forms.DataFormats.FileDrop))
{
string[] files = (string[])e.Data.GetData(System.Windows.Forms.DataFormats.FileDrop);
foreach (string s in files)
{
e.Effect = System.Windows.Forms.DragDropEffects.Copy;

}
return;

}
else
{
e.Effect = System.Windows.Forms.DragDropEffects.None;
}
}


private void listView1_DragOver(object sender, DragEventArgs e)
{
if (e.Data.GetDataPresent(System.Windows.Forms.DataFormats.FileDrop))
{
string[] files = (string[])e.Data.GetData(System.Windows.Forms.DataFormats.FileDrop);
foreach (string s in files)
{
e.Effect = System.Windows.Forms.DragDropEffects.Copy;
}
return;
}
else
{
e.Effect = System.Windows.Forms.DragDropEffects.None;
}

}

Thanks in Advance.

-Ram.

0
parshuram
12/27/2007 7:16:49 AM
asp.net.free-for-all 9281 articles. 0 followers. Follow

1 Replies
887 Views

Similar Articles

[PageSpeed] 59

Not quite sure why it would differ, but there are two things you should change either way.

In DragOver and DragEnter there is no reason to loop the files.  All you're doing is assigning to e.Effect and there's no meaning in doing that several times.

private void listView1_DragEnter(object sender, DragEventArgs e)
{
if (e.Data.GetDataPresent(System.Windows.Forms.DataFormats.FileDrop))
{
    e.Effect = System.Windows.Forms.DragDropEffects.Copy;
}
else
{
e.Effect = System.Windows.Forms.DragDropEffects.None;
}
}


-- "Mark As Answer" if my reply helped you --
0
gunteman
12/27/2007 1:06:03 PM
Reply:

Similar Artilces:

Drag and drop multiple Files into embeded Windows Forms Control in Web Page is not working
 Hi all,I am trying to develop a web application in which I want to have a list box in a form. It should be able to drag and drop the files on to it. It should just capture the file name with the path.I am able to do this in a Windows application, by setting the "AllowDrag" property of the list box to true. How can I achieve this in Web application? For the matter of fact I just want to capture all the names of the files that are dragged on to the form. It need not be list box alone. any other control will also do.Any ideas please.Thanks you all in Advance.-Ram Not possible...

Urgent!!! Form inside Windows form control (that is embedded to Web page i.e aspx), not displayed on button click
 Hi all I have a Windows Form Control(i.e Windows Control Library), that consists of a Button "button1" and  a panel "panel1". Also I have a form "form1.cs". On form "form1.cs" I have a label whose text value i have set to  "Hi". On click of button "button1" on windows form control i am opening the form "form1.cs"  inside a panel and it displays "Hi". The code of windows form control is as below :  public partial class UserControl1 : UserControl    {    ...

Single page with multiple user web controls VS Multiple page with specific user web controls
I have a question regarding single page with multiple user web controls vs multiple page with specific user web controls   Option 1: I am of the opinion to have multiple pages with specific user web controls and use an object to store all the information as the user navigates through the application. And finally at the end, read this object and save all the information to the backend database.   Option 2: My respected team member suggests that we have only one page, with all the specific user web controls and not use an object, instead show/hide the user web controls based ...

drag and drop files from windows explorer to web page
hi,One of our clients needs file upload tool in his web application, which accepts the drag and drop files from the windows explorer.Instead of clicking on browse and select the files he wants to drag and drop on the page to upload. Are there any tools which support this requirement? Please reply with the details if any suggestions to solve trhis I found a similar example written in java, refer- http://www.radinks.com/press/12/file-upload-as-easy-as-drag-and-drop.php Its a java Applet and there are many more like this one. But do not know anything like this in asp .net...

windows control embedded in ASPX page (multiple files upload)
Hi, I've red this interesting article on MSDN: http://msdn.microsoft.com/msdnmag/issues/02/01/UserCtrl/default.aspx tried it out, created the necessary security, build the project, created the client.snk file, ... but when I open up the "testClient.htm" page (http://localhost/serverfileupload/testclient.htm) I only see the dimensions of the object and a button with the text "Upload Files". Does anyone of you tried this example out? It's my first "smart" client so I'm inexperienced with this stuff. I also noticed that the upload.dll doesn't get into the ...

Cant drag-and-drop Web Custom Control to Web Form!
Hi,I'm going insane here, I've read countless articles how to create a Web Custom Control and add it to the Toolbox and then just Drag-and-Drop it to a Web Form.And I have done exactly that except for the last step, any Web Custom Control I create refuses to be Drag-and-Dopped to the Web Form. What happens is the following, after I have added the Web Custom Control to the ToolBox I click it and drag it to the Web Form designer area. First I can see the icon of the Web Custom Control and I see a Referance being created but just after that the icon changes to one of those "you cant park here s...

Drag and Drop from Solution Explorer onto Web Form doesn't drop object but drops file name instead
I can't seem to figure out why, when I drag and drop a user control from Solution Explorer onto my Web Form that the filename, including the directory spec., is dropped on the form rather than the object itself.  This is also true when I drag and drop onto the toolbox.  I can't seem to figure this one out... Hi MichelleBaker, From your description, I understand that when you drag and drop a user control from Solution Explorer to your aspx page, instead of getting a user control instance, you can only get the link with file path of the user control. If there has been any ...

Shell not working in web form but working with windows forms.
Hi! I want to run some exe files (Exa: Internet explorer) using shell command in asp.net. Its not working if its a web form. But working fine with a windows form. Pls. extend ur help. Thanx. What are you expecting to happen? How are you trying to run the exe files? Where do you expect it to run? Anything run through server side code will run on the server, and in an invisible window, at that. The program will run under the security context of the ASPNET user by default, and so likely will not have the proper authority to do much of what you want, unless you midify its rights...

.Net Windows Control in Web Form
Hi all,How can I use a .Net windows control in a web form? I use object tag but it doesn't work and displays empty.Thanks in advance cheers Hi, you can check this article out: Hosting a Windows Control in a Web Form. This shows only how to host the control. If you want interaction with the client you can do this by setting the correct CAS (Code Access Security) settings on the client pc. Grz, Kris.Read my blog. Handy Firefox plugins for web developers.Workaround for non working Mark as answer buttons. Thanks guys for your replycheers...

Does not work on web forms that are multiple pages
Name: Product: Firefox Summary: Does not work on web forms that are multiple pages Comments: Tried filling out a web form at usps.com that has multiple Continues but it does not load the next page. It works fine on older versions. Browser Details: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:2.0b7) Gecko/20100101 Firefox/4.0b7 From URL: http://hendrix.mozilla.org/ Note to readers: Hendrix gives no expectation of a response to this feedback but if you wish to provide one you must BCC (not CC) the sender for them to see it. ...

drag and drop file on web control
I want to drag a file from desktop or Outlook Email and drop it on tree view web control. Is it possible to drop file on IE ?, Any link to sample are appreciated The default behaviour of any browser is to try to open the file that is dropped onto it.  I don't think you will be able to change that.  Also, you should bear in mind that while you think you see a treeview control in IE that looks something like Windows Explorer, all that is is a bunch of html, javascript and images stored locally in your IE temporary internet files.  You can't move files from desktop to l...

Can you return .net web controls in a .net page from a web service?
I've got a problem with a project. I've got to compile an entire .net page and return it as part of a Web Service for display. The problem I have is that I need to add WebControls and functionality to the page so that not only the html content and images are displayed (which I've managed) but that textboxes, labels, buttons and datasets can be displayed also. Essentially I need to make a call from one site for a page, populate the page and return it in a state as though it resided on the same server/webspace as the calling page. Code is currently built as follows into a string: strOpenHT...

superreview cancelled: [Bug 194357] Dragging and dropping a Windows file shortcut (.lnk) in the browser window doesn't work : [Attachment 152079] patch 2
Brodie Thiesfield <brofield@jellycan.com> has cancelled Brodie Thiesfield <brofield@jellycan.com>'s request for superreview: Bug 194357: Dragging and dropping a Windows file shortcut (.lnk) in the browser window doesn't work http://bugzilla.mozilla.org/show_bug.cgi?id=194357 Attachment 152079: patch 2 http://bugzilla.mozilla.org/attachment.cgi?id=152079&action=edit ...

superreview requested: [Bug 194357] Dragging and dropping a Windows file shortcut (.lnk) in the browser window doesn't work : [Attachment 242563] Patch v4
Ryan Jones <sciguyryan+bugzilla@gmail.com> has asked Darin Fisher (Google) <darin@meer.net> for superreview: Bug 194357: Dragging and dropping a Windows file shortcut (.lnk) in the browser window doesn't work https://bugzilla.mozilla.org/show_bug.cgi?id=194357 Attachment 242563: Patch v4 https://bugzilla.mozilla.org/attachment.cgi?id=242563&action=edit ------- Additional Comments from Ryan Jones <sciguyryan+bugzilla@gmail.com> Patch proposed by Biesi. ...

Web resources about - Multiple file drag and drop not working when Windows Forms Control is embeded in Web Page. - asp.net.free-for-all

Code division multiple access - Wikipedia, the free encyclopedia
Code division multiple access ( CDMA ) is a channel access method used by various radio communication technologies. It should not be confused ...

Man stabbed multiple times in street fight
A 23-year-old man suffers multiple stab wounds in a wild street brawl involving up to 100 people.

Facebook Tweaks Power Editor for Users With Multiple Ad Accounts
Facebook rolled out a new feature for its Power Editor that should greatly speed up the process for users with multiple advertising accounts. ...

Rockies trade rumors: Carlos Gonzalez could fit on multiple teams
The oft-injured slugger has two years left on his deal. There are three types of teams in the NL West. Subdividing five teams into three categories ...

Google Ventures reportedly closed its European fund after multiple stalled deals
Earlier this week, Google Ventures announced it was closing down its dedicated European fund . It had been assigned $125 million to invest, but ...

Big Pharma bro arrested by federal agents in overnight raid, faces multiple investigations
Big Pharma bro Martin Shkreli gained international notoriety when his company bought the rights to Daraprim—a drug used to treat parasitic infections, ...

Report: Robert Nkemdiche Fell From A 4th-Story Window And Suffered "Multiple Cuts"
Probable top-five NFL draft pick and Ole Miss star Robert Nkemdiche reportedly fell from the 4th floor of a building, and suffered “multiple ...

Insider allegedly hacked lottery software in multiple states
If you use insider knowledge for your own gain, it could land you in hot water... especially if you hacked the computers at your job to get the ...

A Trick Of Gravity Lets Us Observe An Exploding Star Multiple Times
General relativity warps space and time, and astronomers can use that fact to their advantage.

Threats sent to schools in multiple states, some Indiana districts cancel classes
Threats sent to schools in multiple states, some Indiana districts cancel classes

Resources last updated: 12/23/2015 1:28:12 PM