473,326 Members | 2,813 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

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 2509
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>Untitled Page</title>
<script type="text/javascript">
function hotkey(eventname)
{

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

eventname.keyCode =505;// reset key code

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

return true;
}
</script>
</head>
<body onkeydown="return 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****@microsoft.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?QmlsbHkgWmhhbmc=?= <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>Untitled Page</title>
<script type="text/javascript">
function hotkey(eventname)
{

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

eventname.keyCode =505;// reset key code

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

return true;
}
</script>
</head>
<body onkeydown="return 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****@microsoft.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?QmlsbHkgWmhhbmc=?= <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****@microsoft.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?QmlsbHkgWmhhbmc=?= <ht****@noemail.noemail>
References: <84**********************************@microsoft.co m>
<#S**************@TK2MSFTNGHUB02.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
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...
0
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...
5
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...
3
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...
2
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...
0
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...
1
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...
3
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 ,...
18
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...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.