This is a migrated thread and some comments may be shown as answers.

Press Enter in RadTextBox fires a specific RadButton in a RadAjaxPanle

5 Answers 53 Views
AjaxPanel
This is a migrated thread and some comments may be shown as answers.
Emmanuel
Top achievements
Rank 1
Iron
Emmanuel asked on 09 Oct 2020, 10:25 AM

Hello,

 

We have a RadAjaxPanel with a RadTextBox and a RadButton in it.

How is it possible to fire the RadButton server side event click and press enter in the RadTextBox ?

 

Thank you for your help.

Sincerely.

5 Answers, 1 is accepted

Sort by
0
Vessy
Telerik team
answered on 14 Oct 2020, 08:58 AM

Hi Emmanuel,

If you want to trigger the server-side click when the Enter button is pressed, you can do it with a similar logic:

        <telerik:RadCodeBlock runat="server">
            <script>
                function onKeyPress(textBox, args) {
                    if (args.get_keyCode() == 13) {
                        $find("<%=RadButton1.ClientID%>").click();
                }
            }
            </script>
        </telerik:RadCodeBlock>
        <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server">
            <telerik:RadTextBox ID="RadTextBox1" runat="server">
                <ClientEvents OnKeyPress="onKeyPress" />
            </telerik:RadTextBox>
            <telerik:RadButton ID="RadButton1" runat="server" Text="Submit" AutoPostBack="true" OnClick="RadButton1_Click"></telerik:RadButton>
            <br />
            <telerik:RadLabel ID="labelFilledFromServer" runat="server"></telerik:RadLabel>
        </telerik:RadAjaxPanel>

    protected void RadButton1_Click(object sender, EventArgs e)
    {
        labelFilledFromServer.Text = RadTextBox1.Text;
    }

Regards,
Vessy
Progress Telerik

Five days of Blazor, Angular, React, and Xamarin experts live-coding on twitch.tv/CodeItLive, special prizes, and more, for FREE?! Register now for DevReach 2.0(20).

0
Emmanuel
Top achievements
Rank 1
Iron
answered on 14 Oct 2020, 11:01 AM

Hello,

 

Thank you very much for your reply.

But this is not completely working.

The server side event is fired but the rest of the RadAjaxPanel is not updated and loading panel never disapears.

 

Do you have any idea ?

Thank you

0
Vessy
Telerik team
answered on 14 Oct 2020, 12:40 PM

Hi Emmanuel,

Such behvaior can be faced if there are other AJAxPanels on the page, the result of which is cancelled AJAX reques. Can you confirm that this is not the case at your end and there are no any nesetd AJAX panels on the page?

For convenience, I am attaching my test page to this reply so you can examine it at your end.

Regards,
Vessy
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

0
Emmanuel
Top achievements
Rank 1
Iron
answered on 14 Oct 2020, 02:36 PM

Hello again,

Yes I confirm that there is no other AJAX Panel on the page (nested or not).

It occurs in a Sitefinity widget (ascx) in which we a Radajaxpanel wrapping a RadListView, a RadTextBox and a RadButton.

We also have a RadAjaxLoadingPanel connected to the RadAjaxPanel.

 

Nothing more....

No javascript error when occurs....

0
Vessy
Telerik team
answered on 15 Oct 2020, 12:48 PM

Hi Emmanuel,

Thank you for the additional details. As AJAX is often known to hide both client- and server-side errors, can you remove the used AjaxPanel temporary and see if there are still no errors thrown on the page?

Regards,
Vessy
Progress Telerik

Five days of Blazor, Angular, React, and Xamarin experts live-coding on twitch.tv/CodeItLive, special prizes, and more, for FREE?! Register now for DevReach 2.0(20).

Tags
AjaxPanel
Asked by
Emmanuel
Top achievements
Rank 1
Iron
Answers by
Vessy
Telerik team
Emmanuel
Top achievements
Rank 1
Iron
Share this question
or