Skip to main content

Microsoft Silverlight

Answered Question How to Fire a Button when Pressing the Enter Key + SilverlightRSS Feed

(0)

kargo
kargo

Member

Member

36 points

77 Posts

How to Fire a Button when Pressing the Enter Key + Silverlight

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
vincracker

Contributor

Contributor

3116 points

522 Posts

Re: How to Fire a Button when Pressing the Enter Key + Silverlight

Just handle the keypressed/KeyDown/KeyUp event on textboxes/passwordbox and call DoLogin. As simple as that.

kargo
kargo

Member

Member

36 points

77 Posts

Re: How to Fire a Button when Pressing the Enter Key + Silverlight

Hi,

    sorry i cant get you. can you tell me little bit more or any example.

thanks,

kargo.

vincracker
vincracker

Contributor

Contributor

3116 points

522 Posts

Answered Question

Re: Re: How to Fire a Button when Pressing the Enter Key + Silverlight

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.

  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities