473,394 Members | 1,875 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,394 software developers and data experts.

Quick question on Default button..

Been a while since I looked into this and have forgotten how to make the
ENTER default to a LinkButton and it does on a standard button. If I
remember correctly it required javascript.

Thanks

--
Rocky Moore
www.HintsAndTips.com / Share your tips - Earn rewards
www.MyQuickPoll.com / 2004 Election poll ID #33
www.GotTheAnswerToSpam.com / Block virtually all spam email
www.RJSoft.com/Products/RJContentPanel/ - Free web user template content
control!
Nov 18 '05 #1
5 1232
Rocky,

TextBox.Attributes.Add("onkeydown", "javascript:if((event.which &&
event.which == 13) || (event.keyCode && event.keyCode ==
13)){document.Form1." & Button.ClientID & ".click();return false;}else
return true;")
--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"Rocky Moore" <gR*********@hintsandtips.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Been a while since I looked into this and have forgotten how to make the
ENTER default to a LinkButton and it does on a standard button. If I
remember correctly it required javascript.

Thanks

--
Rocky Moore
www.HintsAndTips.com / Share your tips - Earn rewards
www.MyQuickPoll.com / 2004 Election poll ID #33
www.GotTheAnswerToSpam.com / Block virtually all spam email
www.RJSoft.com/Products/RJContentPanel/ - Free web user template content
control!

Nov 18 '05 #2
Thanks!

--
Rocky Moore
www.HintsAndTips.com / Share your tips - Earn rewards
www.MyQuickPoll.com / 2004 Election poll ID #33
www.GotTheAnswerToSpam.com / Block virtually all spam email
www.RJSoft.com/Products/RJContentPanel/ - Free web user template content
control!

"S. Justin Gengo" <sjgengo@aboutfortunate[no-spam].com> wrote in message
news:10*************@corp.supernews.com...
Rocky,

TextBox.Attributes.Add("onkeydown", "javascript:if((event.which &&
event.which == 13) || (event.keyCode && event.keyCode ==
13)){document.Form1." & Button.ClientID & ".click();return false;}else
return true;")
--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"Rocky Moore" <gR*********@hintsandtips.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Been a while since I looked into this and have forgotten how to make the
ENTER default to a LinkButton and it does on a standard button. If I
remember correctly it required javascript.

Thanks

--
Rocky Moore
www.HintsAndTips.com / Share your tips - Earn rewards
www.MyQuickPoll.com / 2004 Election poll ID #33
www.GotTheAnswerToSpam.com / Block virtually all spam email
www.RJSoft.com/Products/RJContentPanel/ - Free web user template content
control!


Nov 18 '05 #3
Opps. Spoke before I looked. That is only for a specific text box, I am
looking for one that will work for all controls on the page, not adding code
to every one.

--
Rocky Moore
www.HintsAndTips.com / Share your tips - Earn rewards
www.MyQuickPoll.com / 2004 Election poll ID #33
www.GotTheAnswerToSpam.com / Block virtually all spam email
www.RJSoft.com/Products/RJContentPanel/ - Free web user template content
control!
"S. Justin Gengo" <sjgengo@aboutfortunate[no-spam].com> wrote in message
news:10*************@corp.supernews.com...
Rocky,

TextBox.Attributes.Add("onkeydown", "javascript:if((event.which &&
event.which == 13) || (event.keyCode && event.keyCode ==
13)){document.Form1." & Button.ClientID & ".click();return false;}else
return true;")
--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"Rocky Moore" <gR*********@hintsandtips.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Been a while since I looked into this and have forgotten how to make the
ENTER default to a LinkButton and it does on a standard button. If I
remember correctly it required javascript.

Thanks

--
Rocky Moore
www.HintsAndTips.com / Share your tips - Earn rewards
www.MyQuickPoll.com / 2004 Election poll ID #33
www.GotTheAnswerToSpam.com / Block virtually all spam email
www.RJSoft.com/Products/RJContentPanel/ - Free web user template content
control!


Nov 18 '05 #4
Rocky,

If you want a specific button clicked when the user could be anywhere on the
page combine the other script with this one:

<script language="JavaScript">
<!--
if (document.layers) document.captureEvents(Event.KEYPRESS); // needed if
you wish to cancel the key

document.onkeyup = keyhandler;

function keyhandler(e) {
if (document.layers)
Key = e.which;
else
Key = window.event.keyCode;
if (Key != 0)
alert("Key pressed! ASCII-value: " + Key);
}
//-->
</script>

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"Rocky Moore" <gR*********@hintsandtips.com> wrote in message
news:OJ**************@TK2MSFTNGP10.phx.gbl...
Opps. Spoke before I looked. That is only for a specific text box, I am
looking for one that will work for all controls on the page, not adding code to every one.

--
Rocky Moore
www.HintsAndTips.com / Share your tips - Earn rewards
www.MyQuickPoll.com / 2004 Election poll ID #33
www.GotTheAnswerToSpam.com / Block virtually all spam email
www.RJSoft.com/Products/RJContentPanel/ - Free web user template content
control!
"S. Justin Gengo" <sjgengo@aboutfortunate[no-spam].com> wrote in message
news:10*************@corp.supernews.com...
Rocky,

TextBox.Attributes.Add("onkeydown", "javascript:if((event.which &&
event.which == 13) || (event.keyCode && event.keyCode ==
13)){document.Form1." & Button.ClientID & ".click();return false;}else
return true;")
--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"Rocky Moore" <gR*********@hintsandtips.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Been a while since I looked into this and have forgotten how to make the ENTER default to a LinkButton and it does on a standard button. If I
remember correctly it required javascript.

Thanks

--
Rocky Moore
www.HintsAndTips.com / Share your tips - Earn rewards
www.MyQuickPoll.com / 2004 Election poll ID #33
www.GotTheAnswerToSpam.com / Block virtually all spam email
www.RJSoft.com/Products/RJContentPanel/ - Free web user template content control!



Nov 18 '05 #5
Thanks, that is real close to what I ended up with. Found the example MSDN
for a hot key. Made a tip of it as:

http://www.hintsandtips.com/ShowTip/106/hat.aspx

Just not sure how it will work if a person is in a text area control that
normally uses the ENTER Did not have the time to test.

Thanks again for your posts!

--
Rocky Moore
www.HintsAndTips.com / Share your tips - Earn rewards
www.MyQuickPoll.com / 2004 Election poll ID #33
www.GotTheAnswerToSpam.com / Block virtually all spam email
www.RJSoft.com/Products/RJContentPanel/ - Free web user template content
control!

"S. Justin Gengo" <sjgengo@aboutfortunate[no-spam].com> wrote in message
news:10*************@corp.supernews.com...
Rocky,

If you want a specific button clicked when the user could be anywhere on the page combine the other script with this one:

<script language="JavaScript">
<!--
if (document.layers) document.captureEvents(Event.KEYPRESS); // needed if
you wish to cancel the key

document.onkeyup = keyhandler;

function keyhandler(e) {
if (document.layers)
Key = e.which;
else
Key = window.event.keyCode;
if (Key != 0)
alert("Key pressed! ASCII-value: " + Key);
}
//-->
</script>

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"Rocky Moore" <gR*********@hintsandtips.com> wrote in message
news:OJ**************@TK2MSFTNGP10.phx.gbl...
Opps. Spoke before I looked. That is only for a specific text box, I am
looking for one that will work for all controls on the page, not adding

code
to every one.

--
Rocky Moore
www.HintsAndTips.com / Share your tips - Earn rewards
www.MyQuickPoll.com / 2004 Election poll ID #33
www.GotTheAnswerToSpam.com / Block virtually all spam email
www.RJSoft.com/Products/RJContentPanel/ - Free web user template content
control!
"S. Justin Gengo" <sjgengo@aboutfortunate[no-spam].com> wrote in message
news:10*************@corp.supernews.com...
Rocky,

TextBox.Attributes.Add("onkeydown", "javascript:if((event.which &&
event.which == 13) || (event.keyCode && event.keyCode ==
13)){document.Form1." & Button.ClientID & ".click();return false;}else
return true;")
--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"Rocky Moore" <gR*********@hintsandtips.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
> Been a while since I looked into this and have forgotten how to make

the > ENTER default to a LinkButton and it does on a standard button. If I > remember correctly it required javascript.
>
> Thanks
>
> --
> Rocky Moore
> www.HintsAndTips.com / Share your tips - Earn rewards
> www.MyQuickPoll.com / 2004 Election poll ID #33
> www.GotTheAnswerToSpam.com / Block virtually all spam email
> www.RJSoft.com/Products/RJContentPanel/ - Free web user template content > control!
>
>



Nov 18 '05 #6

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

Similar topics

0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...

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.