0

行ごとに がありRepeaterます。と同じ行にLinkButtonある他のコントロール ( など) の値を読み取れるようにしたいと考えています。現在使用しているコードは次のとおりですが、リンクボタンの「クリック」メソッドに何を入れて、行の他のコントロールの値を取得すればよいかわかりません。LabelLinkButton

リピーター ItemDataBound

Private Sub Repeater_ItemDataBound(sender As Object, e As System.Web.UI.WebControls.RepeaterItemEventArgs) Handles Repeater.ItemDataBound

   Dim oRow As xsdTable.MyDataTableRow
   Dim RemoveLinkButton As LinkButton

   RemoveLinkButton = e.Item.FindControl("RemoveLinkButton")
   AddHandler RemoveLinkButton.Click, AddressOf RemoveLinkButton_Click

   // Set other Controls Information   

End Sub

RemoveLinkBut​​ton クリック イベント

Public Sub RemoveLinkButton_Click(sender As Object, e As System.EventArgs)

    // Not sure what to do here to get the id for that row and identify the other 
    // controls to get the information from them...

End Sub
4

1 に答える 1

1

NamingContainerコントロールのプロパティを使用 して、次のものを取得できRepeaterItemます。

Public Sub RemoveLinkButton_Click(sender As Object, e As System.EventArgs)

    Dim control = DirectCast(sender, Control)
    Dim item = DirectCast(control.NamingContainer, RepeaterItem)
    ' now use FindControl to get the other controls in this item '

End Sub
于 2012-11-15T16:23:03.597 に答える