Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Call a specific button onClick event when the enter key is pressed C#

I'm trying to get a specific asp:button onclick event to fire when I press the enter key in a specific asp:textbox control.

The other factor to be taken into account is that the button is within a asp:Login control template.

I've no idea how to do this, suggestions on a postcard please.

like image 251
Static Tony Avatar asked Nov 06 '08 12:11

Static Tony


2 Answers

You could look at the DefaultButton property of the panel control.

like image 111
kͩeͣmͮpͥ ͩ Avatar answered Sep 30 '22 02:09

kͩeͣmͮpͥ ͩ


You could set the DefaultButton property on the form. Either as an attribute of the form tag in your markup DefaultButton = "btnSubmit" or using something like this in your code-behind:

Page.Form.DefaultButton = "btnSubmit"
like image 30
Andrew Van Slaars Avatar answered Sep 30 '22 03:09

Andrew Van Slaars