Completed
Last Updated: 30 Jun 2025 11:40 by ADMIN
Aron Calder
Created on: 27 Jun 2025 12:59
Category: Button
Type: Bug Report
0
OnClick event of the Button is not triggered when a CompareValidator and AjaxManager are no the page

When AjaxManager and CompareValidator are both placed on the same Page, the RadButton as the DefaultButton for the Panel does not make a Postback if hitting the Enter key while the focus is on the TextBox.

Code to replicate the problem:

<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" />

<table>
    <asp:Panel ID="Panel1" runat="server" DefaultButton="btnSearch">
        <tr>
            <td>
                <telerik:RadTextBox ID="txtSearch" runat="server" MaxLength="25" Width="100%" InputType="Number"></telerik:RadTextBox>

                <asp:CompareValidator ID="cmpDataType" runat="server" ControlToValidate="txtSearch" Operator="DataTypeCheck" Type="Integer" Display="Dynamic" Text="Value must be integer" ValidationGroup="SearchGroup">
                </asp:CompareValidator>

                <telerik:RadButton ID="btnSearch" runat="server" Text="Search" Primary="true" OnClick="btnSearch_Click" UseSubmitBehavior="true" ValidationGroup="SearchGroup">
                </telerik:RadButton>

                <%--<asp:Button ID="btnSearch" runat="server" Text="Search" OnClick="btnSearch_Click" />--%>
            </td>
        </tr>
    </asp:Panel>
</table>

C# - Code to display the message when the button successfully performs the PostBack on Enter.

protected void btnSearch_Click(object sender, EventArgs e)
{
    Response.Write("Search button clicked!");
}

The behavior works fine with a regular ASP Button.

1 comment
ADMIN
Attila Antal
Posted on: 30 Jun 2025 11:40

Hello Aron,

Thank you for reporting the problem. We've investigated the issue and turned out the invalid HTML breaks the Control's behavior. 

An HTML table element could not contain a DIV (asp:Panel) as immediate child. Per the HTML standards, contents of a table must be placed inside the table cells (<td></td>).

 <table>
     <asp:Panel ID="Panel1" runat="server" DefaultButton="btnSearch">
         <tr>
             <td>

By moving the table's opening and closing tags within the asp:Panel fixes the issue.

Example

<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" />

<asp:Panel ID="Panel1" runat="server" DefaultButton="btnSearch">
    <table>
        <tr>
            <td>
                <telerik:RadTextBox ID="txtSearch" runat="server" MaxLength="25" Width="100%" InputType="Number"></telerik:RadTextBox>

                <asp:CompareValidator ID="cmpDataType" runat="server" ControlToValidate="txtSearch" Operator="DataTypeCheck" Type="Integer" Display="Dynamic" Text="Value must be integer" ValidationGroup="SearchGroup">
                </asp:CompareValidator>

                <telerik:RadButton ID="btnSearch" runat="server" Text="Search" Primary="true" OnClick="btnSearch_Click" UseSubmitBehavior="true" ValidationGroup="SearchGroup">
                </telerik:RadButton>

                <%--<asp:Button ID="btnSearch" runat="server" Text="Search" OnClick="btnSearch_Click" />--%>
            </td>
        </tr>
    </table>
</asp:Panel>

 

Regards,
Attila Antal
Progress Telerik

Stay tuned by visiting our public roadmap and feedback portal pages! Or perhaps, if you are new to our Telerik family, check out our getting started resources