Link to home
Start Free TrialLog in
Avatar of Ken H.
Ken H.

asked on

How can I copy text from a text box to the clipboard

I am looking for a method to copy data from an asp.net webpage to the computers clipboard.

I've seen some people say use System.Windows.Forms - but when i try to declare that for import it doesn't show up. I've also read that you shouldn't use this in web applications.

What is the correct way to implement a simple copy to clipboard from a single multiline text box?
Avatar of Rajkumar Gs
Rajkumar Gs
Flag of India image

You can use 'Clipboard' for this purpose.
Like explained here - http://bytes.com/topic/visual-basic-net/answers/347730-copy-cut-paste

Raj
Avatar of Ken H.
Ken H.

ASKER

"Clipboard" is not an available control for me. I have System.Web.UI.Control declared. What am i missing?
Avatar of Ken H.

ASKER

I'm not sure the second link is good because that is for windows forms. I read somewhere that in asp.net you should use the System.Web.UI controls not System.Windows.Forms
Yes. I got confused that you are in windows forms. Let me check for Asp.Net

Raj
I believe - this is the right solution for you in ASP.Net - http://forums.asp.net/t/1077651.aspx

Using clipboardData Object - http://msdn.microsoft.com/en-us/library/ms535220.aspx

Hope this helps
Raj
Avatar of Ken H.

ASKER

from what I have been reading it looks like to do this in a web page requires javascript. the copy to clipboard cannot be performed from the code behind page. still researching just fyi
ASKER CERTIFIED SOLUTION
Avatar of jagrut_patel
jagrut_patel
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Ken H.

ASKER

Using the VB clipboard object with multiple users can cause undesired results. Keeping it on the host side is the best answer and because of browser security and difficulty to implement cross platform I'm going to give jagrut_patel credit. That thread does make a valid point. While nice to fully automate the process it's probably best not to especially when folks using this app will be running an assortment of browsers because thats what people in my company do for some reason.