Copying the label text using LinkButton to clipboard says
"Current thread must be set to single thread apartment (STA) mode before OLE calls can be made. Ensure that your Main function has STAThreadAttribute marked on it."
Here is my asp tag..
<asp:Label ID="label" runat="server" Text="text to be copied"></asp:Label>
<asp:LinkButton ID="LinkButton1" runat="server" OnClick="LinkButton1_Click">LinkButton</asp:LinkButton>
Code-behind: C#
protected void LinkButton1_Click(object sender, EventArgs e)
{
Clipboard.SetText(label.Text);
}
While click this LinkButton it shows error as I said above.. I could not use javascript / jquery in my application.. It is purely the server side web application. Please do post possible solution in c# itself.. If you all suggest me javascript clipboard, please provide me the solution that works out in all browser.