Skip to main content
Home Forums General Silverlight Installation and Setup How to Fire a Button when Pressing the Enter Key + Silverlight
3 replies. Latest Post by vincracker on August 4, 2009.
(0)
kargo
Member
36 points
77 Posts
08-04-2009 7:08 AM |
In my login page i have given UserName and Password after that i tried to login through Enter Key Press.In my page i have a login Button.How to fire this login button with the help of pressing the Enter Key.
thanks,
kargo.
vincracker
Contributor
3116 points
522 Posts
08-04-2009 7:14 AM |
Just handle the keypressed/KeyDown/KeyUp event on textboxes/passwordbox and call DoLogin. As simple as that.
08-04-2009 7:34 AM |
Hi,
sorry i cant get you. can you tell me little bit more or any example.
08-04-2009 8:46 AM |
ok, I think you wants to handle enter only on Username textbox and Password box. So go ahead and add KeyDown event handler for both of the controls. Now go in code behind for those new events and check which key is pressed using the parameter "e"(something like e.KeyCode = Keys.Enter), and if you found enter then call your login method or button click event.