1
나는 DataList
이고 각 데이터 목록은 label
및 button
입니다. 버튼을 클릭 할 때마다 라벨 텍스트를 가져 오려고합니다. 데이터 목록 행? vb.net
을 사용 중입니다.동일한 행에서 버튼을 클릭했을 때 데이터 목록의 레이블에 액세스하는 방법
나는 DataList
이고 각 데이터 목록은 label
및 button
입니다. 버튼을 클릭 할 때마다 라벨 텍스트를 가져 오려고합니다. 데이터 목록 행? vb.net
을 사용 중입니다.동일한 행에서 버튼을 클릭했을 때 데이터 목록의 레이블에 액세스하는 방법
버튼 CommandName 속성을 설정하여 DataList
의 ItemCommand 이벤트를 처리한다고 가정합니다.
Sub Item_Command(sender As Object, e As DataListCommandEventArgs)Handles DataList1.ItemCommand
' What command was triggered?
If e.CommandName = "YourCommandName" Then
' Get the Label in the DataListItem of the clicked button
Dim lbl = DirectCast(e.Item.FindControl("Label1"), Label)
Dim labelText = lbl.Text
End If
End Sub