Completed
Last Updated: 09 Dec 2016 14:08 by ADMIN
ADMIN
Danail Vasilev
Created on: 19 May 2014 14:23
Category: FormDecorator
Type: Bug Report
0
FIX double clicking of a decorated button by RadFormDecorator when it is a defaultbutton of a panel and is clicked with enter key
For the time being you can capture the keypress event of the submitting button and cancel it only if the Enter key is pressed. For example:

        <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
            <script>
                Sys.Application.add_load(function () {
                    var decoratedButton = Telerik.Web.UI.RadFormDecorator.getDecoratedElement($get("<%=SearchButton.ClientID%>"));
                    cancelKeyPress(decoratedButton);
                });

                function cancelKeyPress() {
                    Array.forEach(arguments, function (element) {
                        $addHandler(element, "keypress", function (event) {
                            if (event.charCode == 13)
                                $telerik.cancelRawEvent(event.rawEvent);
                        });
                    });
                }

            </script>
        </telerik:RadCodeBlock>
        <telerik:RadFormDecorator ID="RadFormDecorator1" runat="server" DecoratedControls="All" />
        <asp:Panel ID="SearchPanel" runat="server" DefaultButton="SearchButton">
            <telerik:RadTextBox FocusedStyle-CssClass="textfocused" TabIndex="1" HoveredStyle-CssClass="texthover"
                ID="SearchText" runat="server" Width="200px" Height="22px" />
            <asp:Button ID="SearchButton" runat="server" Text="Search" TabIndex="3" OnClick="SearchButton_Click" OnClientClick="alert(1);return true;" />
        </asp:Panel>
0 comments