ActiveX .NET Drag&Drop control work fine in windows form not in webForm

D

deccio

I have create an activex Control with Visual studio 2005 and framework
2.0 in c# to add drag & drop functionality to upload multi file.
When I use it in a windows form it work fine. Infact if I select 3
files from a windows explorer and I move it in a listbox in my
activeX, I find my 3 files added in the listbox but if I use my
activeX in a web form and I select 3 file from a windows explorer in
the listBox find only 1 file the file on which the mouse is on when
the drag & drop operation begin.

I post some code..

private void listBox1_DragDrop(object sender, DragEventArgs e)
{
Array a = (Array)e.Data.GetData(DataFormats.FileDrop);

if (a != null)
{
// if i execute the activeX in a windows Form the
a.Length property value is the exact number of file that i have
selected
// if i execute the activeX in a web Form the
a.Length property value is always 1 for (int i =0 ;
i< a.Length; i++)
{ string s
= a.GetValue(i).ToString();

if (!listBox1.Items.Contains(s))
{
string filename =
System.IO.Path.GetFileName(s);
listBox1.Items.Add(filename);
}
}
}
}


Anyone knows why in web Form The value of a.Length is Always 1?

Thanks wery much
 
A

Alvin Bruney [ASP.NET MVP]

I have create an activex Control with Visual studio 2005 and framework
I don't think that's possible so I have to assume you are talking about a
managed user control.

There's more going on here that what you are admitting to. This simply
wouldn't work as is in a web form, you'd need to tweak CAS policy. To debug
your issue, what you should do is wire a mouse down event that spits out the
number of objects. Modify your dragdrop routine to spit out the number of
objects in the array. When you run the app, if these two numbers are
different, it's a windows issue and not your issue. Otherwise, it's fixable.

--

Regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
The O.W.C. Black Book, 2nd Edition
Exclusively on www.lulu.com/owc $19.99
 
D

deccio

I have create an activex Control with Visual studio 2005 and framework

I don't think that's possible so I have to assume you are talking about a
managed user control.

There's more going on here that what you are admitting to. This simply
wouldn't work as is in a web form, you'd need to tweak CAS policy. To debug
your issue, what you should do is wire a mouse down event that spits out the
number of objects. Modify your dragdrop routine to spit out the number of
objects in the array. When you run the app, if these two numbers are
different, it's a windows issue and not your issue. Otherwise, it's fixable.

--

Regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
The O.W.C. Black Book, 2nd Edition
Exclusively onwww.lulu.com/owc$19.99
-------------------------------------------------------


I have create an activex Control with Visual studio 2005 and framework
2.0 in c# to add drag & drop functionality to upload multi file.
When I use it in a windows form it work fine. Infact if I select 3
files from a windows explorer and I move it in a listbox in my
activeX, I find my 3 files added in the listbox but if I use my
activeX in a web form and I select 3 file from a windows explorer in
the listBox find only 1 file the file on which the mouse is on when
the drag & drop operation begin.
I post some code..
private void listBox1_DragDrop(object sender, DragEventArgs e)
{
Array a = (Array)e.Data.GetData(DataFormats.FileDrop);
if (a != null)
{
// if i execute the activeX in a windows Form the
a.Length property value is the exact number of file that i have
selected
// if i execute the activeX in a web Form the
a.Length property value is always 1 for (int i =0 ;
i< a.Length; i++)
{ string s
= a.GetValue(i).ToString();
if (!listBox1.Items.Contains(s))
{
string filename =
System.IO.Path.GetFileName(s);
listBox1.Items.Add(filename);
}
}
}
}
Anyone knows why in web Form The value of a.Length is Always 1?
Thanks wery much

It was a cas problem. Thanks for the suggestion.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top