Solved

Image button in a Repeater not firing event onclick

Posted on 2006-07-18
2
692 Views
Last Modified: 2012-05-05
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
Comment
Question by:WhiteEagle
2 Comments
 
LVL 10

Accepted Solution

by:
ibost earned 125 total points
ID: 17132425
I would think the likely reason is your repeater is getting rebuilt during postback... for instance you may be inadvertently rebinding the data.
0
 

Author Comment

by:WhiteEagle
ID: 17136571
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now