Solved

Handle Keypress event on a WebForm?

Posted on 2004-04-28
3
370 Views
Last Modified: 2008-03-10
Hi there!

I want to call a CodeBehind Function on a WebForm by pressing "return" (or any other key).
I only know the keypress event on windows.forms, but how can i use something equal in WebForms?
Please help me out!

Regards
Claudio
0
Comment
Question by:Chillahh
3 Comments
 
LVL 9

Accepted Solution

by:
Thalox earned 125 total points
ID: 10938911

i think there is no "direct" way to do this.

but you can catch the event on the client with javascript (add onKeyPressed - event to an element)
and in this eventhandler put the captured keyvalue in a hidden inputfield and post back your page to the sever.

now you just need to evaluate the value of this field in your code-behind page and call your function

Hope this helps,

Thalox
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question