Copy to clipboard

J

Jon Prisbe

I have a user requirement to add the ability to copy selected rows from a
listbox on an ASP.NET page to the clipboard. I am iterating through the
selected rows and building a string to copy to the clipboard. If I try to add
a CRLF after each item (so the rows can later be pasted into a multi-line
text box) the copy to clipboard fails. I can add tab characters, commas, etc.

How do I add multiples CRLF ended lines of text to the clipboard?

My code:

string script = "<SCRIPT language=javascript> ";
script += "window.clipboardData.setData(\"Text\",\"";
script += MyCRLFDelimitedString + "\"); </script>";
System.Web.HttpContext.Current.Response.Write(script);

Thanks,
Jon
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,141
Messages
2,570,817
Members
47,365
Latest member
BurtonMeec

Latest Threads

Top