Clipboard not working

Welcome to Wisej Support.
Questions, suggestions and plain old bugs - are all welcome here!
0
0

Hi,

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?

Regards
Gerald
  • You must to post comments
0
0

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().

Solution:
Clipboard.SetClientText(“<text>”);
Eval(String.Format(@”Wisej.Core.copy();”));

 

Thank you.
Regards
Gerald.

  • You must to post comments
1
1

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.

HTH

Best,

Luca

 

 

  • You must to post comments
Showing 2 results
Your Answer
Post as a guest by filling out the fields below or if you already have an account.
Name*
E-mail*
Attachment
File Name Size
There are currently no files uploaded.
Maximum number of files 5, maximum file size 3.9MB.
Supported file formats: zip pdf gif jpg bmp png cs vb theme json