Default button in aspx

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

hey,

I have an aspx page with some textboxes and 3 buttons.
How can I set the defaultbutton?

tkx
Nic
 
You can do it programmatically via JavaScript:

<script language="JavaScript">
mycoolform1.mytextbox1.focus();
</script>
 
Hi,

This will just give the focus to the button, not the intended
functionality, the default button is the one that is activeted when pressed
Enter enywhere in the form

I haven't tried this but you can try one of this solutions:
1- insert a button of type submit :
<input type=submit runat=server onclick=MethodTOCall

2- Intercept the onKeyDown event in the page when you get a return call the
onClick method of the button:
document.onKeyDown="KeyHandler"

KeyHandler( e)
{
// put here the code
}


Cheers,
 
Back
Top