473,395 Members | 1,941 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,395 software developers and data experts.

Clipboard Question

Hi Group!

I am using asp.net 1.1 with vb.net 2003

In an asp.net page I click a button to return a result

I would like to add a button or link that selects the entire result of the
lblResult control text & copies it to the clipboard

How do I do this

TIA

ASP.NET Newbie
Nov 9 '06 #1
5 1365
Hi,

you can do this with JavaScript i.e.:

http://www.codeproject.com/jscript/CopyasHTML.asp

But notice that this is only working in Internet Explorer.

--
Best regards | Schöne Grüße
Michael

Microsoft MVP - Most Valuable Professional
Microsoft MCAD - Certified Application Developer

http://weblogs.asp.net/mschwarz/
http://www.ajaxpro.info/


"Newbie" <ne****@coding.hellopeepsschrieb im Newsbeitrag
news:%2****************@TK2MSFTNGP02.phx.gbl...
Hi Group!

I am using asp.net 1.1 with vb.net 2003

In an asp.net page I click a button to return a result

I would like to add a button or link that selects the entire result of the
lblResult control text & copies it to the clipboard

How do I do this

TIA

ASP.NET Newbie


Nov 9 '06 #2
Thanks for your reply but its not what I want at all

If you have a asp label with some text in it

I want to be able to click a link or a button to send that label's text to
the clipboard, that's all

MVP's should't reply with useless links, as I am looking for 1) VB.NET
server side code or 2) javascript that runs off a server control

"Michael Schwarz" <no****@schwarz-interactive.dewrote in message
news:ez**************@TK2MSFTNGP02.phx.gbl...
Hi,

you can do this with JavaScript i.e.:

http://www.codeproject.com/jscript/CopyasHTML.asp

But notice that this is only working in Internet Explorer.

--
Best regards | Schöne Grüße
Michael

Microsoft MVP - Most Valuable Professional
Microsoft MCAD - Certified Application Developer

http://weblogs.asp.net/mschwarz/
http://www.ajaxpro.info/


"Newbie" <ne****@coding.hellopeepsschrieb im Newsbeitrag
news:%2****************@TK2MSFTNGP02.phx.gbl...
Hi Group!

I am using asp.net 1.1 with vb.net 2003

In an asp.net page I click a button to return a result

I would like to add a button or link that selects the entire result of
the
lblResult control text & copies it to the clipboard

How do I do this

TIA

ASP.NET Newbie


Nov 9 '06 #3
Hi "Newbie",
"Newbie" <ne****@coding.hellopeepsschrieb im Newsbeitrag
news:ei**************@TK2MSFTNGP04.phx.gbl...
Thanks for your reply but its not what I want at all

If you have a asp label with some text in it

I want to be able to click a link or a button to send that label's text to
the clipboard, that's all
MVP's should't reply with useless links, as I am looking for 1) VB.NET
server side code or 2) javascript that runs off a server control
You don't need VB.NET server-side code for this because server-side cannot
copy text to the clipboard, that is the reason for the link where you will
find the JavaScript source code you need for this action. But here is the
VB.NET code if you have a label called Label1 and a button called Button1:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load
Button1.OnClientClick =
"window.clipboardData.setData('Text',document.getE lementById('" + _
Label1.ID + "').innerHTML);"
End Sub

--
Best regards | Schöne Grüße
Michael

Microsoft MVP - Most Valuable Professional
Microsoft MCAD - Certified Application Developer

http://weblogs.asp.net/mschwarz/
http://www.ajaxpro.info/

>
"Michael Schwarz" <no****@schwarz-interactive.dewrote in message
news:ez**************@TK2MSFTNGP02.phx.gbl...
>Hi,

you can do this with JavaScript i.e.:

http://www.codeproject.com/jscript/CopyasHTML.asp

But notice that this is only working in Internet Explorer.

--
Best regards | Schöne Grüße
Michael

Microsoft MVP - Most Valuable Professional
Microsoft MCAD - Certified Application Developer

http://weblogs.asp.net/mschwarz/
http://www.ajaxpro.info/


"Newbie" <ne****@coding.hellopeepsschrieb im Newsbeitrag
news:%2****************@TK2MSFTNGP02.phx.gbl...
Hi Group!

I am using asp.net 1.1 with vb.net 2003

In an asp.net page I click a button to return a result

I would like to add a button or link that selects the entire result of
the
lblResult control text & copies it to the clipboard

How do I do this

TIA

ASP.NET Newbie




Nov 9 '06 #4
OnClientClick is not a member of web control buttons is the error I get when
adding your code to the vb code behind the asp.net page
"Michael Schwarz" <no****@schwarz-interactive.dewrote in message
news:et****************@TK2MSFTNGP03.phx.gbl...
Hi "Newbie",
"Newbie" <ne****@coding.hellopeepsschrieb im Newsbeitrag
news:ei**************@TK2MSFTNGP04.phx.gbl...
Thanks for your reply but its not what I want at all

If you have a asp label with some text in it

I want to be able to click a link or a button to send that label's text
to
the clipboard, that's all
MVP's should't reply with useless links, as I am looking for 1) VB.NET
server side code or 2) javascript that runs off a server control

You don't need VB.NET server-side code for this because server-side cannot
copy text to the clipboard, that is the reason for the link where you will
find the JavaScript source code you need for this action. But here is the
VB.NET code if you have a label called Label1 and a button called Button1:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load
Button1.OnClientClick =
"window.clipboardData.setData('Text',document.getE lementById('" + _
Label1.ID + "').innerHTML);"
End Sub

--
Best regards | Schöne Grüße
Michael

Microsoft MVP - Most Valuable Professional
Microsoft MCAD - Certified Application Developer

http://weblogs.asp.net/mschwarz/
http://www.ajaxpro.info/


"Michael Schwarz" <no****@schwarz-interactive.dewrote in message
news:ez**************@TK2MSFTNGP02.phx.gbl...
Hi,

you can do this with JavaScript i.e.:

http://www.codeproject.com/jscript/CopyasHTML.asp

But notice that this is only working in Internet Explorer.

--
Best regards | Schöne Grüße
Michael

Microsoft MVP - Most Valuable Professional
Microsoft MCAD - Certified Application Developer

http://weblogs.asp.net/mschwarz/
http://www.ajaxpro.info/


"Newbie" <ne****@coding.hellopeepsschrieb im Newsbeitrag
news:%2****************@TK2MSFTNGP02.phx.gbl...
Hi Group!

I am using asp.net 1.1 with vb.net 2003

In an asp.net page I click a button to return a result

I would like to add a button or link that selects the entire result
of
the
lblResult control text & copies it to the clipboard

How do I do this

TIA

ASP.NET Newbie





Nov 9 '06 #5
This is .NET 2.0 sourc code, if you use it in .NET 1.1 you will use this
code:

Button1.Attributes.Add("onclick",
"window.clipboardData.setData('Text',document.getE lementById('" + _
Label1.ID + "').innerHTML);"
Note, that you should use the HtmlButton instead of the
System.Web.UI.WebControls.Button.
--
Best regards | Schöne Grüße
Michael

Microsoft MVP - Most Valuable Professional
Microsoft MCAD - Certified Application Developer

http://weblogs.asp.net/mschwarz/
http://www.ajaxpro.info/


"Newbie" <ne****@coding.hellopeepsschrieb im Newsbeitrag
news:%2****************@TK2MSFTNGP02.phx.gbl...
OnClientClick is not a member of web control buttons is the error I get
when
adding your code to the vb code behind the asp.net page
"Michael Schwarz" <no****@schwarz-interactive.dewrote in message
news:et****************@TK2MSFTNGP03.phx.gbl...
>Hi "Newbie",
"Newbie" <ne****@coding.hellopeepsschrieb im Newsbeitrag
news:ei**************@TK2MSFTNGP04.phx.gbl...
Thanks for your reply but its not what I want at all

If you have a asp label with some text in it

I want to be able to click a link or a button to send that label's text
to
the clipboard, that's all
MVP's should't reply with useless links, as I am looking for 1) VB.NET
server side code or 2) javascript that runs off a server control

You don't need VB.NET server-side code for this because server-side
cannot
copy text to the clipboard, that is the reason for the link where you
will
find the JavaScript source code you need for this action. But here is the
VB.NET code if you have a label called Label1 and a button called
Button1:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load
Button1.OnClientClick =
"window.clipboardData.setData('Text',document.get ElementById('" + _
Label1.ID + "').innerHTML);"
End Sub

--
Best regards | Schöne Grüße
Michael

Microsoft MVP - Most Valuable Professional
Microsoft MCAD - Certified Application Developer

http://weblogs.asp.net/mschwarz/
http://www.ajaxpro.info/

>
"Michael Schwarz" <no****@schwarz-interactive.dewrote in message
news:ez**************@TK2MSFTNGP02.phx.gbl...
Hi,

you can do this with JavaScript i.e.:

http://www.codeproject.com/jscript/CopyasHTML.asp

But notice that this is only working in Internet Explorer.

--
Best regards | Schöne Grüße
Michael

Microsoft MVP - Most Valuable Professional
Microsoft MCAD - Certified Application Developer

http://weblogs.asp.net/mschwarz/
http://www.ajaxpro.info/


"Newbie" <ne****@coding.hellopeepsschrieb im Newsbeitrag
news:%2****************@TK2MSFTNGP02.phx.gbl...
Hi Group!

I am using asp.net 1.1 with vb.net 2003

In an asp.net page I click a button to return a result

I would like to add a button or link that selects the entire result
of
the
lblResult control text & copies it to the clipboard

How do I do this

TIA

ASP.NET Newbie




Nov 10 '06 #6

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

Similar topics

8
by: LG | last post by:
Just have a question with regards to the clipboard, and how to read what other applications (Adobe InDesignCS) place in the clipboard. I am currently in the process of creating a booklet from a...
1
by: Silesian | last post by:
Hi all, I have a small routine that copies a text field in my application. I want to be able to do this: Clipboard.SetDataObject ("") ,after the user has pasted the text into another application....
0
by: Christopher | last post by:
Hello, First, I appologize for the length but I want to get all the facts down so as not to waste any time :) I'm trying to allow the user of my C# app to copy a DataGrid full of double values...
4
by: JohnR | last post by:
Hi all, I'm finally sick and tired of manually generating get/set properties for each private variable in a class so I'm trying to create a macro to do it. I'm stuck because I can't figure out...
0
by: James Russo | last post by:
Hello, I have an application which requires an image to be retrived from the clipboard. So, I am writting a quick C# windows application to take images from a webcam and store a single frame on...
3
by: Lee | last post by:
Hi, How do i check to see if the clipboard is empty? thanks in advance lee
0
by: MKBender | last post by:
dear all, I'm try to differential between datagridview data that is copied from a cell and a row. If I can setup two clipboards that would make it easy? is this possible? Seeing how both the row...
7
by: Newbie | last post by:
How do I clear the clipboard in VB.NET 2003? TIA Newbie
23
by: Over | last post by:
Hi it's possible with language C, (Mingw or Djgpp) copying the clipboard of WinXp into file.txt? which function must be use. Thanks
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?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.