1
火我有一個LinkButton中繼器內,我想,當用戶點擊LinkButton的刪除的項目;在這種情況下,不會觸發LinkButton的ItemCommand事件,我的代碼如下:ItemCommand不與LinkButton的
<asp:Repeater ID="rptSubject" runat="server" OnItemCommand="rptSubject_OnItemCommand">
<ItemTemplate>
<tr>
<td><asp:CheckBox id="chkAll" runat="server"/></td>
<td><%#Eval("SubjectName") %></td>
<td>
<asp:ImageButton ID="imgbtnDelete" ImageUrl="~/assets/images/icons/delete.png" runat="server" CommandName="Delete" CommandArgument='<%#Eval("SubjectID") %>'/>
<asp:LinkButton ID="lnkEditCategory" runat="server" CommandName="EditCategory" CommandArgument='<%#Eval("SubjectID") %>' Text="Edit Category"></asp:LinkButton>
</td>
</tr>
</ItemTemplate>
我直放站的ItemCommand事件處理程序是:
protected void rptSubject_OnItemCommand(object source, RepeaterCommandEventArgs e)
{
if (e.CommandName.Equals("Delete"))
{
// some code
}
if (e.CommandName.Equals("EditCategory"))
{
// some code
}
}
當我點擊圖像按鈕,我的項目命令事件觸發,但當我點擊鏈接按鈕它沒有。