本文介绍了ASP.NET MVC粘贴到剪贴板的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个ASP.NET MVC 4应用程序。

I have a ASP.NET MVC 4 app.

我要复制文本(来自PDF)CTRL + C并将其作为参数粘贴到

I want to copy a text(from PDF) CTRL+C and paste it as parameter in a method from a controller.

我的网络网格具有带有ActionLink的列

My webgrid has column with an ActionLink

grid.Column(" ", " ", format: @<a href="@Url.Action("Clipboard", "People", new { cbdata = window.clipboardData.getData('Text') })">Clipboard</a>),

...

    [HttpPost]
    public ActionResult Clipboard(string cbdata) // is string ok ?
    {
        //I'm doing something with my clipboard data ..
        return View();
    }

这部分无效: window.clipboardData.getData('文字')
是否需要在Global.asax.cs中修改我的MapRoute?

This part is not working : window.clipboardData.getData('Text')Do I have to modify my MapRoute in Global.asax.cs ?

Q :如何我可以通过控制器中的方法从剪贴板中获取数据吗?

Q : How can I get the data from my clipboard in a method from my controller ?

推荐答案

您想从客户端剪贴板中获取数据到Web服务器?

You want to get data from a client's clipboard to the web server?

您不能。安全是一个问题。如果某人的信用卡详细信息从以前的副本保存到剪贴板中,该怎么办!

You can't. Security is an issue. What if someone had their credit card details saved in their clipboard from a previous copy!

唯一的方法是要求用户将其明确粘贴到文本中控制并以表格形式发送。.

The only way to do that is to ask the user to explicitly paste it into a text control and send it in a form..

这篇关于ASP.NET MVC粘贴到剪贴板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-18 19:39