Home All Groups Group Topic Archive Search About
Author
9 Jan 2006 2:25 PM
Chris Zopers
Hello,

I've developed an ASP.NET page with some controls on it. One of the
controls is an imagebutton. Can I assign the Enter-key to this button,
so when a user presses the Enter key, the click-event will fire? I know
there's a accesskey property, but this is for ALT plus the key that is
entered. I would like to use the Enter key.

Greetings,
Chris.

*** Sent via Developersdex http://www.developersdex.com ***

Author
9 Jan 2006 4:43 PM
Phillip Williams
You can assign the onkeypress event (from the DHTML Object Model) to trigger
a button's click event using JavaScript.  I have a demo that explains how to
set a page's default submit button and default buttons for each other section
on the web page: http://www.societopia.net/samples/ASPPage_Buttons.aspx

Show quoteHide quote
"Chris Zopers" wrote:

> Hello,
>
> I've developed an ASP.NET page with some controls on it. One of the
> controls is an imagebutton. Can I assign the Enter-key to this button,
> so when a user presses the Enter key, the click-event will fire? I know
> there's a accesskey property, but this is for ALT plus the key that is
> entered. I would like to use the Enter key.
>
> Greetings,
> Chris.
>
> *** Sent via Developersdex http://www.developersdex.com ***
>
Author
10 Jan 2006 4:30 PM
Wouter van Vugt
If you are using ASP.NET 2.0, it is easy. Just set the DefaultButton
property on a Panel or on the <form runat="server" defaultbutton="">

Grtz,

Wouter van Vugt
Trainer - Info Support
http://blogs.infosupport.com/wouterv