Clipboard not working



I am trying to copy some information within a Wisej.Web.UserControl to the clipboard so I can paste it on the client site into an Excel spreadsheet.
This should be done after the dedicated button is pressed and it worked under VWG.

Clipboard.SetText("<gettingTextFromDictionary>" + "\t" + "<gettingTextFromDictionary>");

With Visual Web Gui you had to call "Clipboard.Update(TextDataFormat.UnicodeText, true);" to send the information to the client.
How can this be done in WiseJ?

  • You must to post comments

Hi Luca,

Thank you for your answer.

For some reason the example you mentioned did not work initially like it is shown in the screencast.
Ctrl+C was not recognized, maybe this is a problem while running in a VirtualBox environment.

I have a click action in the UserControl where the data is finally gathered and then send to the clipboard. After that I was able to get the text with Wisej.Core.copy().



Thank you.

  • You must to post comments

Hi Gerald,

The clipboard cannot be updated directly unless the  update is initiated by a user action. VWG’s clipboard code doesn’t work with modern browsers – in chrome I always get “ReferenceError: cliboardData is not defined”. Didn’t try with other browsers after looking at the code in VWG referencing non-existing components and referring to Java applets…

Wisej’s Cliboard class works on the server side and it can transfer data to the client using Clipboard.SetClientText(“hello”). Clipboard.SetClientText() saves the text to a temporary storage. Then you must have the user click something and use javascript in response to the user action to copy the clipboard content to the browser’s clipboard calling Wisej.Core.copy(). This is a common and widely used technique, probably the only one that works.

You can find an example here. There is a screencast too here.

And a ton of posts around using clipboard.js, zeroclipboard, etc. – all not working when trying to access the clipboard processing an ajax request. It only works with a user initiated action in all modern browsers.






  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.