Unplanned
Last Updated: 16 Jun 2025 11:01 by Avery
Avery
Created on: 16 Jun 2025 11:01
Category: AutoCompleteBox
Type: Bug Report
1
AutoCompleteBox removes all jquery event handlers from the document

The issue is observable when AJAX is enabled using asp:UpdatePanel, telerik:RadAjaxPanel, or telerik:RadAjaxManager because the event handlers are not added back to elements upon an AJAX postback. When no AJAX panels are used, the entire document is rendered, and all handlers are attached to elements again.

 

Reproduction

  1. Add the code listed below to a page
  2. Load the page for the first time.
  3. Open the Chrome DevTools and monitor the Console tab.
  4. Click on the page anywhere except the button, the console will show 'Document clicked'.
  5. Click on the Button to perform an AJAX post back.
  6. At this point, the click event handler attached to the document no longer exists. Clicking anywhere on the document will not log the message in the console anymore.

Code

<asp:UpdatePanel runat="server">
    <ContentTemplate>
        <telerik:RadAutoCompleteBox ID="RadAutoCompleteBox1" runat="server"></telerik:RadAutoCompleteBox>
        <asp:Button ID="Button1" runat="server" Text="Post Back" />
    </ContentTemplate>
</asp:UpdatePanel>

<script>
    $(document).on('click', function (e) {
        console.log('Document clicked');
    });
</script>


 

 

0 comments