C# 如何在 asp.net 中制作“添加到剪贴板”功能

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/13468284/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-10 08:41:18  来源:igfitidea点击:

How to make "Add to clipboard" functionality in asp.net

c#asp.net.net

提问by Rajaram Shelar

How do I achieve add to clipboardfunctionality in asp.net web site, if I have to copy text in textbox or label. Please help

如果我必须复制文本框或标签中的文本,如何在 asp.net 网站中实现添加到剪贴板功能。请帮忙

采纳答案by Levi Botelho

You need to implement this with JavaScript, as copying to the user's clipboard has to be done on the client machine and not on the server. See this post:

您需要使用 JavaScript 来实现这一点,因为复制到用户的剪贴板必须在客户端机器上完成,而不是在服务器上。看到这个帖子:

How do I copy to the clipboard in JavaScript?

如何在 JavaScript 中复制到剪贴板?