c# - Making a button click when pressing enter instead of clicking the control -


i'm trying make button called btnsubmit submit customer's information if hit enter on keyboard. know in vs2012 if i'm coding strictly c#, can change properties , set button activated when enter pressed.

because coding in .net c#, not have option control. advice coding? can't find anything.

i working web form.

i think trick.

don't attempt trigger button click. should refactor code event handlers separated actual implementation. e.g.

void form_keydown(object sender, keyeventargs e) {     if (e.keycode == keys.enter)     {         checkanswer();     } }  public void button1_click(object sender, eventargs e) {     checkanswer(); }  private void checkanswer() {     // stuffs on button click  } 

Comments

Popular posts from this blog

1111. appearing after print sequence - php -

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

Ruby on Rails, ActiveRecord, Postgres, UTF-8 and ASCII-8BIT encodings -