【问题标题】:GridView RowCommand copy to clipboard the e.CommandArgument ValueGridView RowCommand 将 e.CommandArgument 值复制到剪贴板
【发布时间】:2016-08-30 13:18:17
【问题描述】:
Protected Sub GridView_Paga_AT_0_RowCommand(sender As Object, e As GridViewCommandEventArgs)

    If e.CommandName = "C_Nif" Then

        Dim row As GridViewRow = DirectCast(DirectCast(e.CommandSource, Control).NamingContainer, GridViewRow)
        Dim Botao_Nif As ImageButton = TryCast(row.FindControl("ImageButton_C_Nif"), ImageButton)
        Dim Nif As String = e.CommandArgument
        Botao_Nif.Attributes.Add("onclick", "function copyClipboard(){window.clipboardData.setData('Text'," + Nif + ");CopiedTxt.execCommand('Copy');}")

    End If

End Sub

【问题讨论】:

  • 有什么问题?

标签: vba gridview copy clipboard rowcommand


【解决方案1】:

经过一番搜索,对我来说最好的解决方案是:

    If e.CommandName = "C_Nif" Then

        Dim row As GridViewRow = DirectCast(DirectCast(e.CommandSource, Control).NamingContainer, GridViewRow)
        Dim Botao_Nif As ImageButton = TryCast(row.FindControl("ImageButton_C_Nif"), ImageButton)

        Dim Nif As String = e.CommandArgument
        Botao_Nif.Attributes.Add("onclick", "window.prompt(""To copy use Ctrl+C. Close with Enter.""," + Nif + ");")

    End If

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-05-15
    • 1970-01-01
    • 2020-02-06
    相关资源
    最近更新 更多