0

This is my code

   <asp:Button ID="btnCompute" runat="server"  OnClick="btnCompute_Click" Text=""  onkeypress="return tabE(this,event)"/> 

when enter key press only the javascript function execute, I also want to execute the button click event on server side when user press enter key. How will I do this?

1 Answer 1

0

If you want to execute your btnCompute_Click() function, just add it to your onkeypress attribute and separate your commands with a semicolon.

onkeypress="btnCompute_Click(); return tabE(this,event)"
Sign up to request clarification or add additional context in comments.

2 Comments

I already try that approach but the button click is not executing
do you have focus on the button when you are doing the keypress? You can probably tab to the button to try it out. Then press a key.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.