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?
|
|
|
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>
|
|
|
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
|
|
|
|