ImageButton in datalist doesn't capture event

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top