CodeCharge Studio
search Register Login  

Web Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> .NET

 default Button with the <ENTER> key

Print topic Send  topic

Author Message
RainerSchober

Posts: 4
Posted: 07/18/2005, 7:33 AM

what do i have to do on VB.NET to make the default button (for excample "Search") react on the <ENTER> key as it does on ASP?

View profile  Send private message
shogedal

Posts: 12
Posted: 08/04/2005, 4:45 AM

Here is a solution that has worked for me when I only have one form (the search form) on a page (put it at the beginning of the HTML file):

<script type="text/javascript"><!--This script allows you to submit the page with <Enter> -->  
if (document.layers){  
	document.captureEvents(Event.KEYDOWN);  
}  
  
document.onkeydown =   
function (evt) {  
	var keyCode = evt ? (evt.which ? evt.which : evt.keyCode) : event.keyCode;  
	if (keyCode == 13) {  
		if (window.navigator.appName.toLowerCase().indexOf("microsoft") > -1) {  
			theform = document._ctl0;  
		}  
		else {  
			theform = document.forms["_ctl0"];  
		}  
		theform.SearchButton_DoSearch.click();  
		return false;  
	}  
	else  
	{  
		return true;  
	}  
};  
  
</script>  
View profile  Send private message
E43509

Posts: 283
Posted: 08/19/2005, 11:29 AM

If you have only one text box in a form, this is a known issue with browsers and asp.net Check out http://www.allasp.net/enterkey.aspx for more info. (and click on the discuss link for the simple approach) Basically, I put in a hidden dummy text box of 0 length on single text box forms. If you wan to prevent it from happening check out http://support.microsoft.com/default.aspx?scid=kb;en-us;Q298498
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.