View Full Version : Assain a "code behind" function to a key?

Sep 26, 2008, 6:29 AM
Is it possible to assign a certain code behind function to a key press depending on which object that has the focus.
The code demostrates what I want to do, the OnKey evens is made up but shows my intentions.

protected string CodeBehindFunction(){

<ext:TextField ID="TextField1" runat="server" OnKey="CodeBehindFunction()"> </ext:TextField>

Best regards
Mikael Jürke

Sep 26, 2008, 8:31 AM
Hi Mikael,

Adding events to certain key(s) combinations is very much possible in ExtJS, although we have yet to build in the functionality to the Coolite Toolkit source so that you can add programaticly with code-behind or markup.

Can you explain further what key/combination scenario you would like to enable?

There was a good blog post recently presenting some information about adding a KeyMap, see http://extjs.com/blog/2008/09/23/keyboard-handling/

Sep 26, 2008, 9:13 AM
Hi again,
I need to call a codebehind function from a keybutton, therefor i can not use the ExtJS, (at least not with my limited knowledge of javascript). I would like to enable "enter"-key when I stand in a ext:TextField and then call a function. I also would like enable combinations like "alt+a" or "alt+b" ect..
In the program in building im using, the viewport. And in this viewport area there are several buttons. Instead of clicking them with the mouse, I would like to access them with keycombos like "alt+a".
Hope you get what I need?

Best regards
Mikael Jürke