Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

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

0 views
Skip to first unread message

deccio

unread,
May 16, 2008, 5:07:16 AM5/16/08
to
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

Alvin Bruney [ASP.NET MVP]

unread,
May 16, 2008, 10:07:42 PM5/16/08
to
> 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
-------------------------------------------------------


"deccio" <denis...@gmail.com> wrote in message
news:2527ef3f-5169-4f85...@x35g2000hsb.googlegroups.com...

deccio

unread,
May 21, 2008, 1:24:05 PM5/21/08
to
On 17 Mag, 04:07, "Alvin Bruney [ASP.NET MVP]" <vapor dan using hot

male spam filter> wrote:
> > 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
> -------------------------------------------------------
>
> "deccio" <denis.co...@gmail.com> wrote in message

It was a cas problem. Thanks for the suggestion.

0 new messages