Forum Moderators: open
I'm suprised the Seach button doesn't have a design time property making it the default button for the form. Anyone know a way to force a button click based on a whap on the enter key?
Thanks,
Ross
I also tried calling the Search.click() from the form's onSubmit event in javascript but that didn't do the trick.
In whatever event handler gets called you could determine whether the form was actually submitted by checking whether the submitted data contain a control name/value pair for the submit button.
Andreas
Alternatively you can use the onSubmit action of the form. onSubmit calls a client-side javascript that fakes an Click event on the submit button.
var go = false;
function forceButton(x) {
if (! go) {
go = true;
x.search.click();
return(false);
}
return(true);
}
In whatever event handler gets called you could determine whether the form was actually submitted by checking whether the submitted data contain a control name/value pair for the submit button.
Hopefully someone else will find the posted code useful. I'm still baffled as to why .Net doesn't allow a button to be set as the default for the page.