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

  • Thread starter Thread starter Guest
  • Start date Start date
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
 
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?
 
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?
 
Back
Top