E
ewillyb
Hi,
ASP.NET has some interesting behavior when the user hits the Enter key.
If there are multiple ASP:Buttons (rendered as HTML submits) on the
form, when the user hits enter, the first button's click event will
fire and the page will submit.
I have a series of pages with Previous and Next navigational Btns. The
Previous button is the first button, so when the user hits enter, the
previous page is served up. Enter should result in the NEXT page being
served up.
I would like to capture the Enter keystroke, suppress the Previous Btn
click event and call a method to trigger the Next Btn click event, thus
submitting the page correctly.
That's putting it simply. My implementation is slightly more
complicated. The Previous and Next Btns are on a user control (so they
can be used on each page). Also, on some pages, there are more buttons
and different scenarios in which an Enter Click should not result in
the page submitting at all. I basically need to capture the Enter
click so that I may then determine where the user's focus is and then
call the right handlers.
I'm pretty sure JavaScript will be needed in this solution.
Thanks!
Eric
ASP.NET has some interesting behavior when the user hits the Enter key.
If there are multiple ASP:Buttons (rendered as HTML submits) on the
form, when the user hits enter, the first button's click event will
fire and the page will submit.
I have a series of pages with Previous and Next navigational Btns. The
Previous button is the first button, so when the user hits enter, the
previous page is served up. Enter should result in the NEXT page being
served up.
I would like to capture the Enter keystroke, suppress the Previous Btn
click event and call a method to trigger the Next Btn click event, thus
submitting the page correctly.
That's putting it simply. My implementation is slightly more
complicated. The Previous and Next Btns are on a user control (so they
can be used on each page). Also, on some pages, there are more buttons
and different scenarios in which an Enter Click should not result in
the page submitting at all. I basically need to capture the Enter
click so that I may then determine where the user's focus is and then
call the right handlers.
I'm pretty sure JavaScript will be needed in this solution.
Thanks!
Eric