我想訪問與其中啓動ItemCommand的RepeaterItem關聯的數據。該方案是,我有一個Button控件在命令設置聲明這樣多RepeaterItems:在命令執行中訪問與RepeaterItem相關聯的數據
<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