Solved

Handle Keypress event on a WebForm?

Posted on 2004-04-28
3
350 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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

746 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now