473,394 Members | 1,845 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Windows Control hosted in WebForm

I need to be able to allow users to drag files to a list box on a web
page. To this end, I created a Windows Control and hosted it in a
WebForm. When the file is dropped onto the listbox, the path of the
file is truncated down to 8.3 format (with the ~1 at the end). When the
Windows control is hosted in a windows form (for testing purposes) the
full path is displayed.

Is there some setting that will allow the full path to be displayed when
hosted in a WebForm?

Alternatively, is there a different way to achieve the desired
functionality without using a WinForm control?

And less importantly, when hosted in an WebForm, the control is only
able to accept 1 file at a time. When hosted in a WinForm, the control
can accept multiple files. Any ideas?

Thanks

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

private void listBox1_DragDrop(object sender,
System.Windows.Forms.DragEventArgs e)
{
try
{
string[] files = null;
if (e.Data.GetDataPresent(System.Windows.Forms.DataFo rmats.FileDrop))
{
files = (string[])e.Data.GetData("FileDrop", true);
}

foreach (string s in files)
{
listBox1.Items.Add(s);
}
}
catch (Exception exp)
{
System.Windows.Forms.MessageBox.Show(exp.Message);
}
}

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 17 '05 #1
2 1854
Perhaps you could use the GetLongPathName API call in your windows control
to convert the 8.3 format.
Here's more information:
http://msdn.microsoft.com/library/de...ngpathname.asp
http://www.activevb.de/rubriken/apik...pathnamea.html

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
Hire top-notch developers at http://www.able-consulting.com


"Matt Theule" <usenet at mattsolutions dot com_> wrote in message
news:u5**************@TK2MSFTNGP11.phx.gbl...
I need to be able to allow users to drag files to a list box on a web
page. To this end, I created a Windows Control and hosted it in a
WebForm. When the file is dropped onto the listbox, the path of the
file is truncated down to 8.3 format (with the ~1 at the end). When the
Windows control is hosted in a windows form (for testing purposes) the
full path is displayed.

Is there some setting that will allow the full path to be displayed when
hosted in a WebForm?

Alternatively, is there a different way to achieve the desired
functionality without using a WinForm control?

And less importantly, when hosted in an WebForm, the control is only
able to accept 1 file at a time. When hosted in a WinForm, the control
can accept multiple files. Any ideas?

Thanks

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

private void listBox1_DragDrop(object sender,
System.Windows.Forms.DragEventArgs e)
{
try
{
string[] files = null;
if (e.Data.GetDataPresent(System.Windows.Forms.DataFo rmats.FileDrop))
{
files = (string[])e.Data.GetData("FileDrop", true);
}

foreach (string s in files)
{
listBox1.Items.Add(s);
}
}
catch (Exception exp)
{
System.Windows.Forms.MessageBox.Show(exp.Message);
}
}

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 17 '05 #2
Thanks for the idea, but calling the API from the web hosted windows
control generated a ReflectionPermissions exception.

I did find that using the Framework wizard to adjust the .Net Security
allowed the full path to be shown without the use of the API. Although
everything at this point is on my development workstation, I had to
adjust the 'Local Intranet' zone to 'Full Trust'. The 'My Computer'
zone was defaulted to 'Full Trust'.

I had previously registered the windows control assembly as trusted, but
that did not make a difference.

Now I have to go figure out what is happening when the trust level is
adjusted.


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: andy.g.ward | last post by:
I keep getting this when trying to create an MFC activex control in a c# windows service - anyone got any ideas what the missing module could be??? Exception thrown :...
1
by: Mehr H | last post by:
I've been trying to figure out how i can embed a Windows.Forms.ProgressBar in my webform (aspx) file. I have tried putting a Windows.Forms.ProgressBar as public on a regular winform designer form...
3
by: EJ1003 | last post by:
Hello I would like to create Activex Control uisng C# and use it in ASP.Net webform. User Control is not solving my requirement so I am going for Activex Control. Please guide me on this, how...
10
by: ej1008 | last post by:
HI all I am having a windows Control running on ASP.Net webform. From this windows control I am trying to connect to database to do some database operations. Now I am facing problem while...
0
by: kashif kazi via DotNetMonster.com | last post by:
Hi all I developed the simple windows control and place it on ASP.net page, it runs fine. Now i developed the win control as follows which uses web services (Combine logic of two sample...
1
by: Moe | last post by:
I have a winForm control that contains an openFileDialog. I am using this control in a webForm by enbedding it using an <object> tag. I need to access some information about the file on the client....
5
by: serge calderara | last post by:
Dear all, I am new in asp.net and prepare myself for exam I still have dificulties to understand the difference between server control and HTML control. Okey things whcih are clear are the fact...
3
by: CodeRazor | last post by:
I have a user contol hosted in a webform. The user control interfaces with an http component. When the user control loads, a request is sent to the http component. It takes around 10 seconds...
14
by: jim | last post by:
OK...Don't ask why - it'll just make ya mad. It makes me mad just thinking about it. I swear....if I didn't need this job, I'd tell 'em where to embed their webbrowser control. But, since I do...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.