Back to Devexpress

The Click event of asp:ImageButton is not raised when the component is located inside a template

aspnet-404586-troubleshooting-grid-related-issues-image-button-click-not-raised.md

latest1.1 KB
Original Source

The Click event of asp:ImageButton is not raised when the component is located inside a template

  • Sep 27, 2023

Error Description

When ASPxGridView sends a callback, the Click event is no longer fired for asp:ImageButton placed inside the DataItemTemplate.

Solution

The asp:ImageButton registers its scripts in the PreRender event handler. The event is raised when the page performs a postback, but not when a callback is sent. Refer to the following topic for more information about callbacks: Callbacks.

To resolve this issue, you can implement any of the following workarounds:

  • Use the ASPxButton control with a background image (the BackgroundImage-ImageUrl property) instead of asp:ImageButton.
  • Set the EnableCallBacks property to false to disable callbacks and place ASPxGridView inside UpdatePanel.