Default button mapped to the Enter key would be "Submit"

G

Guest

I have got a couple of Serverside Button Controls in a page. Each button performs different actions, e.g. Button1 performs Submit, Button2 performs Cancel etc. Now, I want the default button mapped to the Enter key would be "Submit". I know a couple ways to achive this functionality using html buttons. But, how to achieve this functionality with Serverside buttons? Any idea

Thanks in advance
 
S

Simon Storr

you could make the button focus on page load with javascript -
Button1.focus();

You could also set the TabIndex to 1 to make it the 1st control in the tab
order.

Simon

Sanjeeb Sarangi said:
I have got a couple of Serverside Button Controls in a page. Each button
performs different actions, e.g. Button1 performs Submit, Button2 performs
Cancel etc. Now, I want the default button mapped to the Enter key would be
"Submit". I know a couple ways to achive this functionality using html
buttons. But, how to achieve this functionality with Serverside buttons? Any
idea?
 
I

Ian Oldbury

hi Sanjeeb,

If you place this line of code within

Page.RegisterHiddenField("__EVENTTARGET", "btnLogin")

where btnLogin is the name of control that you wish to fire by default.

Hope this helps

ian

Sanjeeb Sarangi said:
I have got a couple of Serverside Button Controls in a page. Each button
performs different actions, e.g. Button1 performs Submit, Button2 performs
Cancel etc. Now, I want the default button mapped to the Enter key would be
"Submit". I know a couple ways to achive this functionality using html
buttons. But, how to achieve this functionality with Serverside buttons? Any
idea?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,571
Members
45,045
Latest member
DRCM

Latest Threads

Top