I have a button "copy" which should copy a before generated text to clipboard.
I have the following code in my SharePoint-WebPart-Application:
public void CopyToClipboard_Click(object sender, EventArgs e)
{
string text = TextBox1.Text;
ScriptManager.RegisterStartupScript(CopyButton, CopyButton.GetType(), "Copy", "clipboardData.setData('text', '" + text + "');", true);
}
The weird thing is that, when I insert my own text in the TextBox1 and press the CopyButton, the text will be copied, but if I want to copy the generated text to the clipboard, nothing happen.
ok, The problem is not really solved. The functionality copy to clipboard is done, but through removing the escape sequences, the text is not formatted: no new lines, the text is in a row.