ItemCommand が起動した RepeaterItem に関連付けられたデータにアクセスしたいと考えています。シナリオは、コマンドが次のように宣言的に設定されている Button コントロールの RepeaterItems が複数あることです。
<asp:Repeater ID="Repeater3"
runat="server"
DataSource='<%# ClientManager.GetClientEmployees(Eval("ClientID")) %>'
OnItemCommand="RemoveEmployeeFromClient">
<ItemTemplate>
<asp:LinkButton ID="LinkButton1"
runat="server"
Text="(x)"
CommandName="RemoveEmployeeFromClient">
</asp:LinkButton>
</ItemTemplate>
<SeparatorTemplate>,<br /></SeparatorTemplate>
</asp:Repeater>
背後にあるコードは次のとおりです。
Protected Sub RemoveEmployeeFromClient(ByVal source As Object,
ByVal e As RepeaterCommandEventArgs)
' I want to access the data associated with
' the RepeaterItem which the Button was clicked.
End Sub