Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to stop windows "DONK" sound on button press 1

Status
Not open for further replies.

NuJoizey

MIS
Aug 16, 2006
450
US
OK, here's one for you cats......

My issue is similar to the below two posts, neither of which worked for me.



I have an aspx page with a text box and a search button. If the user enters something in the search box and then clicks the search button with the mouse, everything is fine, but if the user happens to hit the "enter" key to submit the form, everything still works, except you get that annoying "donk!" windows error sound along with it. This leads the user to believe that some error has occurred when there is none.

of note: the annoying donk sound only seems to happen in IE7, not FF.

How do I make it go away programatically?
 
How do I make it go away programatically?
You can't. That sound is caused by the OS. You can set a default button for the page, so that when they press enter, that click event is triggered.
 
jebenson,

i tried that (well I think I did anyway) by using javascript to capture the enter click event and then by programmatically causing a click event in an attempt to mimic a user clicking the button, but it didn't work...i still get the "donk"- like so:

Code:
 var txtBox = document.activeElement;
                 
 if(txtBox.id=='ctl00_cphActions_txtSearch')
 {
      var btn=window.document.getElementById('ctl00_cphActions_btnFindIt');
      btn.click();
}

is this what you meant? If I can't stop the donk, how do I circumvent the donk?
 
why does it "donk" when the button is clicked programmatically, but not when it is clicked manually? that doens't make sense!!!
 
why does it "donk" when the button is clicked programmatically, but not when it is clicked manually? that doens't make sense!!!
It means that someone pressed enter, and the page doesn't know how to handle it.

By setting a default button, I mean, try this
Code:
<form id="form1" runat="server" defaultbutton="[b]YourButtonNameHere[/b]">
 
ok, but I'm using master pages, is there a way to implement directly on this particular content placeholder? ie, i may want a different defaultbutton on another page.
 
Look up the DefaultButton property in the help files. It will tell you what controls it can apply too.
 
ok. i wrapped my search box in a panel control, and it seems to work as you have specified. Thank you jbenson!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top