473,785 Members | 2,847 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Hotkey in asp.net page

I want to have following hotkey used in asp.net application, how to do this
especially for F5?

ESC
F3
F4
F5
F6
F9
F10
F12
Ctrl+J

Thanks,
-Billy zhang

Jul 8 '08 #1
3 2531
Hi Billy,

As for web application, the key press/down events are handled by
client-side javascript. And you can register "onKeyDown" , "onKeyPress "
script event for the <bodyelement or any other sub container(such as div
, span....). Here are some web articles mentioned this:

#Code Samples : Make Any Key A Hot Key
http://www.15seconds.com/howto/pg000086.htm

#How to Prevent Users to Press F5 key (Refresh button)
http://anujkrathi.blogspot.com/2007/...o-press-f5-key.
html

here is a simple test page I've used for demonstration:

=============== ========
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitl ed Page</title>
<script type="text/javascript">
function hotkey(eventnam e)
{

if(eventname.ke yCode == 116 )
{
alert("\nyou've pressed F5");

eventname.keyCo de =505;// reset key code

return false; //return false to prevent refresh page
}

return true;
}
</script>
</head>
<body onkeydown="retu rn hotkey(event);" >
............... ....
=============== =============

And for complete key code list in javascript key event, here is a good
reference:

#JavaScript KeyCodes List
http://www.aspdotnetfaq.com/Faq/What...or-JavaScript-
KeyDown-KeyPress-and-KeyUp-events.aspx

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsof t.com.

=============== =============== =============== =====
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
=============== =============== =============== =====
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
>From: =?Utf-8?B?QmlsbHkgWmh hbmc=?= <ht****@noemail .noemail>
Subject: Hotkey in asp.net page
Date: Mon, 7 Jul 2008 18:32:01 -0700
>
I want to have following hotkey used in asp.net application, how to do
this
>especially for F5?

ESC
F3
F4
F5
F6
F9
F10
F12
Ctrl+J

Thanks,
-Billy zhang

Jul 8 '08 #2
#How to Prevent Users to Press F5 key (Refresh button)
http://anujkrathi.blogspot.com/2007/...o-press-f5-key.

This link is invalid.

-Billy

"Steven Cheng [MSFT]" wrote:
Hi Billy,

As for web application, the key press/down events are handled by
client-side javascript. And you can register "onKeyDown" , "onKeyPress "
script event for the <bodyelement or any other sub container(such as div
, span....). Here are some web articles mentioned this:

#Code Samples : Make Any Key A Hot Key
http://www.15seconds.com/howto/pg000086.htm

#How to Prevent Users to Press F5 key (Refresh button)
http://anujkrathi.blogspot.com/2007/...o-press-f5-key.
html

here is a simple test page I've used for demonstration:

=============== ========
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitl ed Page</title>
<script type="text/javascript">
function hotkey(eventnam e)
{

if(eventname.ke yCode == 116 )
{
alert("\nyou've pressed F5");

eventname.keyCo de =505;// reset key code

return false; //return false to prevent refresh page
}

return true;
}
</script>
</head>
<body onkeydown="retu rn hotkey(event);" >
............... ....
=============== =============

And for complete key code list in javascript key event, here is a good
reference:

#JavaScript KeyCodes List
http://www.aspdotnetfaq.com/Faq/What...or-JavaScript-
KeyDown-KeyPress-and-KeyUp-events.aspx

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsof t.com.

=============== =============== =============== =====
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
=============== =============== =============== =====
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
From: =?Utf-8?B?QmlsbHkgWmh hbmc=?= <ht****@noemail .noemail>
Subject: Hotkey in asp.net page
Date: Mon, 7 Jul 2008 18:32:01 -0700

I want to have following hotkey used in asp.net application, how to do
this
especially for F5?

ESC
F3
F4
F5
F6
F9
F10
F12
Ctrl+J

Thanks,
-Billy zhang

Jul 8 '08 #3
Thanks for your reply Billy,

It seems the "html" extension is broken (by the line break):

the complete url is:

http://anujkrathi.blogspot.com/2007/...o-press-f5-key.
html

http://............/how-to-prevent-u...ss-f5-key.html

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsof t.com.

=============== =============== =============== =====
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.
=============== =============== =============== =====
This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
>From: =?Utf-8?B?QmlsbHkgWmh hbmc=?= <ht****@noemail .noemail>
References: <84************ *************** *******@microso ft.com>
<#S************ **@TK2MSFTNGHUB 02.phx.gbl>
>Subject: RE: Hotkey in asp.net page
Date: Mon, 7 Jul 2008 23:14:00 -0700
>#How to Prevent Users to Press F5 key (Refresh button)
http://anujkrathi.blogspot.com/2007/...o-press-f5-key
Jul 8 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1912
by: Nitesh Jain | last post by:
I want to write a simple utility, so that if I select a text, and press a hot key say (CTRL+ALT+G), then I should be able to open a google search page with the selected text. Could someone tell me how to get the selected text when this hotkey is pressed.
0
1444
by: kurotsuke | last post by:
Can anybody tell me where I can find a sample C# forms that implements the hotkey selection like in babylon so that the user can actually press the hotkey combination instead of selecting the keys on a listbox? Thanks.
5
3139
by: jcrouse | last post by:
I have an application thats a viewer. I also have a form that is fired from a Tools/Options menu selection. In the Options form the user can select a hotkey to use to exit the main viewer application. On the Options form I have a textbox that the user can use to enter the key he would like to use as the hotkey. I want to allow the hotkey to be letters, numbers and the control keys. When the textbox has focus and the user selects a letter...
3
2606
by: Rsrany | last post by:
I've been working on a few gtk applications and need to tie a hot key catcher into a thread. I am currently finding threaded user32.GetMessageA do not work. I have included two programs: 1) a non-threaded version that works 2) a threaded version that doesnt work. Any constructive suggestions would be helpful
2
8319
by: Marc Gravell | last post by:
Just a thought prompted by the chain "Splitting up a string"; ages ago a wrote (in VB via Windows API dll calls) a global hotkey app that runs silently, intercepts ++V, converts the clipboard to a string and sends +; I still use it almost constantly, but it is a pain to maintain. I couldn't find any native C# support for global hotkey (CLR2.0) - any idea if this could be re-written in C# without any dll imports in my code? Marc
0
1807
by: yasker | last post by:
I register a hotkey following this article: http://www.dotnet2themax.com/ShowContent.aspx?ID=103cca7a-0323-47eb-b210-c2bb7075ba78 Using windows api to archive it. But when I use it as a part of my program(it would minimize to tray before you call it), I found it doesn't work. Finally I found the statement which cause it: this.ShowInTaskbar = false; Though I wrote "ShowInTaskbar = true" later in the program, but hotkey didn't work...
1
5960
by: Rune Jacobsen | last post by:
Hi all, I have some often-performed tasks in my applications that I want users to be able to specify hotkeys for. However, I don't want to hard code these hotkeys, as sooner or later some other app is bound to use the same thing, causing end user frustration. So I want the end user to be able to specify the hot key to use for task X in the configuration window. Now receiving and handling the hotkey is no problem. I do that easily...
3
3926
by: Bob Alston | last post by:
Anyone know how to disable or redefine the Ctrl - hotkey which deletes a record? I have a multi page form that uses 14 records, each record handles 1-2 pages of the 18 page form. Occasionally , after being there initially, one of the records becomes deleted. I have found I can cause this by pressing CTRL and the MINUS key simultaneously. Even the confirm delete doesn't work. Any way to redefine the function of CTRL + MINUS? Bob
18
44737
by: AdamOnAccess | last post by:
Anyone know an easy way to toggle between Form and Design view with a hotkey? I know you can switch from Design view to Form view with hotkey F5. But is there a hotkey to switch back (from Form view to Design)? Shift-F5 is not it. I've searched Google and I can't believe I couldn't find an answer. Please help. Adam
0
9480
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10330
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10153
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9952
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8976
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7500
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6740
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5381
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4053
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.