0
我有一個帶有ImageButton
的ASP.NET中繼器。我的ImageButton
有一個OnCommand
事件。更改ASP.NET中繼器中選定行的顏色
我的目標:當我點擊ImageButton
時,我希望所選行的顏色發生變化。
這是從我的ASP.NET代碼摘錄。誰能幫我?
<asp:Repeater ID="RepeaterID" runat="server" OnItemCommand="rpt_ItemCommand">
<HeaderTemplate>
<table cellpadding="0" cellspacing="0" id="table1">
<thead>
<tr>
<th>
<asp:Label ID="lbl_refCode" runat="server"></asp:Label>
</th>
<th style="width: 25px"></th>
</tr>
</thead>
</table>
</HeaderTemplate>
<ItemTemplate>
<tr id="row" runat="server">
<td style="width: 50px;">
<asp:Label ID="Label2" runat="server" Text='<%# Eval("RefCode") %>'</asp:Label>
</td>
<td style="width: 25px;">
<asp:ImageButton ImageUrl="Icons/edit.png" CommandArgument='<%# Eval("ID") %>' CommandName="Edit" ID="ImgEdit" OnCommand="Manage" runat="server">
</asp:ImageButton>
</td>
</tr>
</ItemTemplate>
<AlternatingItemTemplate>
<tr id="row" runat="server">
<td style="width: 50px;">
<asp:Label ID="Label2" runat="server" Text='<%# Eval("RefCode") %>' </asp:Label>
</td>
<td style="width: 25px;">
<asp:ImageButton ImageUrl="Icons/edit.png" CommandArgument='<%# Eval("ID") %>' CommandName="Edit" ID="ImgEdit" OnCommand="Manage" runat="server">
</asp:ImageButton>
</td>
</tr>
</AlternatingItemTemplate>
<FooterTemplate>
</Table>
</FooterTemplate>
</asp:Repeater>
未檢測到事件rpt_ItemCommand:/ – Jcbo
在Repeater標記中,是否放置了'OnItemCommand =「rpt_ItemCommand」'並將事件代碼放在代碼隱藏中? –
是的,但沒有檢測到事件:( – Jcbo