c#asp.net中的复制和粘贴按钮 [英] copy and paste button in c# asp.net
本文介绍了c#asp.net中的复制和粘贴按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
如何在c#asp.net网页表单中创建复制和粘贴按钮?
我正在使用此代码:
private void btnCopy_Click( object sender,EventArgs e)
{
Clipboard.SetText(txtClipboard。文本);
}
私有 void btnPaste_Click( object sender,EventArgs e)
{
txtResult.Text = Clipboard.GetText();
}
它在IE中正常运行但在Firefox中没有运行。
我不知道什么是错的,请帮助!!
解决方案
我找到了javascript代码
复制&为IE,Firefox和Opera等流行浏览器粘贴JavaScript代码 [ ^ ]
编辑
---- -------------------------
[ ^ ]
EDIT 2
-----------------------------
你没错,在网上发现这些关于安全性的链接事情。
剪贴板不工作 [ ^ ]
< a href =http://kb.mozillazine.org/Clipboard_not_w orking> mozillazine - 剪贴板无效 [ ^ ]
我讨厌Firefox [ ^ ]
< blockquote>为什么不看看剪贴板jQuery插件 [ ^ ]
祝你好运
Espen Harlinn
根据我的理解,非IE浏览器通过源代码不适合剪贴板。既然好像你在同一个网站上使用剪贴板内容,为什么不用你的会话变量?
hi all,
how to create copy and paste button in c# asp.net web forms?
I am using this code:
private void btnCopy_Click(object sender, EventArgs e)
{
Clipboard.SetText(txtClipboard.Text);
}
private void btnPaste_Click(object sender, EventArgs e)
{
txtResult.Text = Clipboard.GetText();
}
its running fine in IE but not in firefox.
I have no idea whats going wrong, plz help!!
解决方案
I found javascript code
Copy & Paste JavaScript Codes for popular browsers like IE,Firefox and opera etc[^]
EDIT
-----------------------------
Clipboard cut, copy and paste with JavaScript[^]
EDIT 2
-----------------------------
You right, found these links in web regarding security things.
Clipboard not working[^]
mozillazine - Clipboard not working[^]
I hate Firefox[^]
Why not take a look at the Clipboard jQuery plugin [^]
Best regards
Espen Harlinn
Fro what I understand, non-IE browsers are not clipboard friendly via source code. Since it appears as if you''re using the clipboard contents within the same web site, why don''t you just use a session variable instead?
这篇关于c#asp.net中的复制和粘贴按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文