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

ClientEvents-OnKeyPress Beep

15 Answers 204 Views
Input
This is a migrated thread and some comments may be shown as answers.
Daniel
Top achievements
Rank 1
Iron
Daniel asked on 13 May 2009, 11:18 PM
Hi. I've got a RadTextBox using ClientEvents-OnKeyPress. It basically just detects if a user pressed the Enter key. It works fine but it makes a beeping sound like when you try to enter invalid input. Like I said the event fires okay just has that annoying beeping sound. Anyway around it?

Daniel

15 Answers, 1 is accepted

Sort by
0
Yavor
Telerik team
answered on 18 May 2009, 10:25 AM
Hi Daniel,

Can you please elaborate a little bit more on your setup. What is the declaration of the control, as well as the declaration of the js? Are you able to replicate the same behavior in the online demos for the control?

All the best,
Yavor
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Daniel
Top achievements
Rank 1
Iron
answered on 18 May 2009, 10:34 PM
Javascript

        function KeyEnterUserName(sender, eventArgs) {  
            var c = eventArgs.get_keyCode();  
            if (c == 13) {  
                var userNameSearch = document.getElementById('Login1$LoginButton');  
                userNameSearch.click();  
            }  
        }  
 

ASPX

<

 

asp:Login ID="Login1" runat="server" BackColor="#F7F6F3" BorderColor="#E6E2D8" BorderPadding="4"

 

 

BorderStyle="Solid" BorderWidth="1px" Font-Names="Verdana" Font-Size="0.8em"

 

 

ForeColor="#333333">

 

<

 

LayoutTemplate>

 


<telerik:RadTextBox ID="UserName" runat="server" Width="136px" ClientEvents-OnKeyPress="KeyEnterUserName" /> 
<asp:Button ID="LoginButton" runat="server" CommandName="Login" Text="Log In" ValidationGroup="Login1" /> 

</

 

asp:Login>

 

</

 

LayoutTemplate>

 


That's a rough cut and paste but the parts of the form. Everything works okay, just beeps when you press the enter key.
0
Dimo
Telerik team
answered on 19 May 2009, 03:29 PM
Hello Daniel,

The beep could be caused by two things:

1) The userNameSearch.click(); line triggers a Javascript error, because the client ID of the login button is not Login1$LoginButton and the getElementById method returns null. The correct ID is Login1_LoginButton.

2) submitting the login form as well as the programmatic click of the button triggers a beep, according to the sound settings in the control panel. You should disable the "Start Navigation" sound.


Regards,
Dimo
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Daniel
Top achievements
Rank 1
Iron
answered on 19 May 2009, 10:33 PM
Thanks for the reply Dimo. The beep that is sounding is the Windows XP Ding.wav not Windows XP Sart.wav. My web browser isn't showing any errors and this is what I've been trying to explain. The events fire without problem, and perform as they should. The getElementById method is obviously finding the Login1$LoginButton control, otherwise it wouldn't fire, right? I just thought it is was worth a mention, as a normal text box doesn't have this 'side effect'.

Daniel
0
Dimo
Telerik team
answered on 20 May 2009, 11:09 AM
Hi Daniel,

OK, can you tell me which Windows event gets fired, so that the Ding.wav sound is played?

Best wishes,
Dimo
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Dean
Top achievements
Rank 1
answered on 17 Jun 2010, 03:48 PM
Did anyone find a solution for this?  I have the same issue.  I have a RadTextBox next to a Button and I want to fire the button click method when the user hits the enter key in the textbox.  But it beeps and does not fire the click event of the button.
0
Dimo
Telerik team
answered on 18 Jun 2010, 07:20 AM
Hello Dean,

We have been unable to reproduce the issue. Feel free to send us a runnable demo for further inspection.

All the best,
Dimo
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Luc Baeten
Top achievements
Rank 1
answered on 23 Jun 2010, 09:56 AM

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="test2.aspx.cs" Inherits="test2" %> 
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
 
<html xmlns="http://www.w3.org/1999/xhtml">  
<head runat="server">  
    <title></title>  
</head> 
<body> 
    <form id="form1" runat="server">  
    <asp:ScriptManager ID="ScriptManager1" runat="server">  
    </asp:ScriptManager> 
    <div> 
 
        <telerik:RadNumericTextBox ID="RadNumericTextBox1" AutoPostBack="true" runat="server">     
        </telerik:RadNumericTextBox>    
      
    </div> 
    </form> 
</body> 
</html> 

Hello Dimo

I could reproduce the mentioned issue with the code above.
I created a RadNumericTextBox on a test page (no code behind). When I define a value inside the RadNumericTextBox and press the enter key, I hear a beep and then the page is submitted.
When I use a RadCombobox and carry out the same actions I don't hear anything, just submit.

regards
Luc Baeten
0
Dimo
Telerik team
answered on 23 Jun 2010, 10:58 AM
Hello Luc,

Thank you for the code snippet, however, no beeping on our side. In my opinion, the problem is related to a computer configuration, but we still do not know which one.

Kind regards,
Dimo
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Luc Baeten
Top achievements
Rank 1
answered on 23 Jun 2010, 12:03 PM
Hi Dimo

It must have something to do with Internet Explorer (I use version 8). When I call the test page in Firefox there is no beep.

regards
Luc
0
Luc Baeten
Top achievements
Rank 1
answered on 23 Jun 2010, 12:51 PM
Hi Dimo

I search the internet and found different results for the same problem. I can disable the beep on my computer but that is not exactly the way to go, in my opinion. Other users will hear tyhe beep also.
I extended the code with the following:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="test2.aspx.cs" Inherits="test2" %> 
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
 
<html xmlns="http://www.w3.org/1999/xhtml">  
<head runat="server">  
    <title></title>  
</head> 
<body> 
    <form id="form1" runat="server">  
    <asp:ScriptManager ID="ScriptManager1" runat="server">  
    </asp:ScriptManager> 
    <div> 
 
        <telerik:RadTextBox ID="txtCommentsInput" runat="server" AutoPostBack="True">  
        </telerik:RadTextBox> 
        <br /> 
        <telerik:RadNumericTextBox ID="RadNumericTextBox1" AllowOutOfRangeAutoCorrect="false" 
            runat="server" Type="Number" AutoPostBack="true" Visible="true">  
            <NumberFormat AllowRounding="true" KeepNotRoundedValue="false" DecimalDigits="0" /> 
        </telerik:RadNumericTextBox> 
      
    </div> 
    </form> 
</body> 
</html> 
 

When I enter text in the RadTextBox I hear the beep after first submit. When I submit the second time without changing the value I don't hear a beep anymore. When I change the value again and submit I hear a beep again.
In the RadNumerixTextbox I hear a beep after each submit with or without changing the value.

When I put this in the codebehind:

using System;  
 
public partial class test2 : System.Web.UI.Page  
{  
    protected void Page_Load(object sender, EventArgs e)  
    {  
        txtCommentsInput.Attributes.Add("onkeydown""if(event.which || event.keyCode){if ((event.which == 13) || (event.keyCode == 13)) {form.submit();return false;}} else {return true}; ");  
    }  

I don't hear any beeps anymore.

regards
Luc
0
Dimo
Telerik team
answered on 24 Jun 2010, 01:11 PM
Hello Luc,

How exactly do you disable the beep on your computer?

Greetings,
Dimo
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Luc Baeten
Top achievements
Rank 1
answered on 24 Jun 2010, 01:46 PM
Hello Dimo

Open Configuration panel > System > Device Manager. In the device manager you have to select  menu item View > Show hidden devices. In the new list of devices you expand Non-Plug and Play drivers. There you will find the device Beep.
Open the Properties window of this device. On the tab Driver you can Start and stop the device and define a different status: Disabled.

regards
Luc
0
Dimo
Telerik team
answered on 24 Jun 2010, 02:10 PM
Hello Luc,

This device is enabled and running on my PC and still no beeps when using RadNumericTextBox. Probably something else is involved as well?

On a side note, eventhough we still do not know the exact cause of the problem, I doubt that we can do anything about it from the control's code. The only sound that I can get from a RadNumericTextBox is when I enable the "Start Navigation" sound from the Control Panel and the control posts back automatically when its value is changed. However, this is normal.

Kind regards,
Dimo
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
kyle perkins
Top achievements
Rank 1
answered on 04 Aug 2010, 09:39 PM
I experienced a similar issue with a RadTextBox in a filter template on my RadGrid.  I had to call eventArgs.set_cancel(true) when the Enter key was pressed in order to prevent the beep.
Tags
Input
Asked by
Daniel
Top achievements
Rank 1
Iron
Answers by
Yavor
Telerik team
Daniel
Top achievements
Rank 1
Iron
Dimo
Telerik team
Dean
Top achievements
Rank 1
Luc Baeten
Top achievements
Rank 1
kyle perkins
Top achievements
Rank 1
Share this question
or