I have a repeater that will bind data's from the database into the text box and every textbox there's a copy button. What I want is to copy the text from the textbox when the copy button was clicked. Btw, I'm using a visual studio 2008 Web Form. I tried using the Clipboard.SetText but didn't work. Im working now with this.
Code Behind:
Protected Sub rpt_ItemCommand(ByVal source As Object,
                              ByVal e      As System.Web.UI.WebControls.RepeaterCommandEventArgs)
        Handles rpt.ItemCommand
    If e.CommandName = "Copy" Then
        Dim btnCopy As System.Web.UI.WebControls.Button = e.Item.FindControl("btnCopy")
        Dim txtMsg As System.Web.UI.WebControls.TextBox = e.Item.FindControl("txtMessage")
        txtMsg.Focus()
        btnCopy.Attributes.Add("onClientClick", "function copyClipboard(){ CopiedTxt = document.selection.createRange();CopiedTxt.execCommand('Copy'); }")
    End If
End Sub
Hope you can help me. Thanks
 
     
    