2010-11-12 6 views

Répondre

2

Étant donné que votre étiquette se trouve dans votre GridView, vous devez parcourir les lignes dans GridView. Vous pouvez utiliser l'événement RowDataBound de GridView parcourir les lignes et accéder à la valeur du contrôle interne. Quelque chose comme ça ..

 Protected Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As GridViewRowEventArgs) 
     If e.Row.RowType = DataControlRowType.DataRow Then 
       If Not e.Row.DataItem Is Nothing Then 
        Dim lbl As Label = CType(e.Row.Cells(1).FindControl("YourLabelName"), Label) 
        If lbl.Text = "Copy" Then 
         TextBox1.Text = lbl.Text 
        End If 
       End If 
     End If 

End Sub

ou si vous voulez copier la valeur de ligne particulière, puis

Dim lbl As Label = DirectCast(DirectCast(e.Item.FindControl("GridView1"), GridView).Rows(0).FindControl("YourLabelName"), Label) 
    TextBox1.Text = lbl.Text 
Questions connexes