• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 700
  • Last Modified:

Image button in a Repeater not firing event onclick

Why don't I get the ItemCommand event fired with the following:

                                                                        <asp:Repeater ID="rptMenubar" Runat=server>
      <ItemTemplate>
      <td>
      <asp:ImageButton ID=imgTest Runat=server CommandArgument=<%# Container.DataItem("Name")%> ImageUrl= <%# Container.DataItem("DefaultImage")%>></asp:ImageButton>
      </td>
      <td width=5 bgcolor="#d7ebf5"><span class="style3"></span></td>
      </ItemTemplate>
      </asp:Repeater>

Although clicking on the button causes a postback, it does not call the following event handler. Why?

 Private Sub rptMenubar_ItemCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.RepeaterCommandEventArgs) Handles rptMenubar.ItemCommand

        Select Case e.CommandArgument

        End Select
    End Sub


0
WhiteEagle
Asked:
WhiteEagle
1 Solution
 
ibostCommented:
I would think the likely reason is your repeater is getting rebuilt during postback... for instance you may be inadvertently rebinding the data.
0
 
WhiteEagleAuthor Commented:
If I use a link button instead of an image button it fires as expected, which wouldn't happen if the repeater is being rebuilt.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now