G
Guest
I have an imagebutton as a datalist item. When I click on the image button,
the event is not fired. It works fine with Linkbutton. Please help.
The code snippet is as followed:
<asp:datalist id="dlTest" runat="server" Width="100%" DataKeyField="test_id"
CellSpacing="2" CellPadding="2">
<ItemTemplate>
<TR><TD style="FONT-SIZE: 10pt" bgcolor="#eeeeee">
<asp:ImageButton id="ibtnImage" Runat="server" CommandName="Show"
ImageUrl="~/images/page.gif"></asp:ImageButton>
<asp:LinkButton ID=tmp Runat=server text="sdfdsf"
CommandName="fire"></asp:LinkButton>
</TD>
</TR>
</ItemTemplate>
</asp:datalist>
---Code behind:---
Private Sub dlTest_ItemCommand(ByVal sender As System.Object, ByVal e As
System.Web.UI.WebControls.DataListCommandEventArgs) Handles dlTest.ItemCommand
Response.Write("e.CommandName=" & e.CommandName)
end sub
the event is not fired. It works fine with Linkbutton. Please help.
The code snippet is as followed:
<asp:datalist id="dlTest" runat="server" Width="100%" DataKeyField="test_id"
CellSpacing="2" CellPadding="2">
<ItemTemplate>
<TR><TD style="FONT-SIZE: 10pt" bgcolor="#eeeeee">
<asp:ImageButton id="ibtnImage" Runat="server" CommandName="Show"
ImageUrl="~/images/page.gif"></asp:ImageButton>
<asp:LinkButton ID=tmp Runat=server text="sdfdsf"
CommandName="fire"></asp:LinkButton>
</TD>
</TR>
</ItemTemplate>
</asp:datalist>
---Code behind:---
Private Sub dlTest_ItemCommand(ByVal sender As System.Object, ByVal e As
System.Web.UI.WebControls.DataListCommandEventArgs) Handles dlTest.ItemCommand
Response.Write("e.CommandName=" & e.CommandName)
end sub