Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / September 2007

Tip: Looking for answers? Try searching our database.

access key

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Claudia Fong - 12 Sep 2007 10:51 GMT
I have this code below:

<asp:Button ID="Button1" runat="server" ACCESSKEY="A" Text="Change
Language" OnClick="Button1_Click" />

Is it possible to initially set the button invisible and when the user
click on ALT-A then the button will become visible?

Just trying to avoid user clicking on that button accidentaly

Cheers!

   Claudi
Alexey Smirnov - 12 Sep 2007 11:11 GMT
> Just trying to avoid user clicking on that button accidentaly

Simply add an alert on click:

<asp:button ... OnClientClick="return confirm('Are you sure?');"
Mark Rae [MVP] - 12 Sep 2007 11:17 GMT
> <asp:Button ID="Button1" runat="server" ACCESSKEY="A" Text="Change
> Language" OnClick="Button1_Click" />
>
> Is it possible to initially set the button invisible and when the user
> click on ALT-A then the button will become visible?

Yes it is but it's very messy, and totally non-standard web behaviour...

But, to answer your question, you'd need to wire up a client-side keypress
event with JavaScript:
http://www.google.co.uk/search?sourceid=navclient&hl=en-GB&ie=UTF-8&rlz=1T4GGIH_
en-GBGB220GB220&q=JavaScript+body+onkeypress


Also, be aware that different browsers capture these events in different
ways, so you'll need to code around that if you require cross-browser
compatibility...

> Just trying to avoid user clicking on that button accidentaly

<asp:Button ID="Button1" runat="server" Text="Change Language"
OnClick="Button1_Click" OnClientClick="return confirm('Are you sure you want
to change the language?');" />

Signature

Mark Rae
ASP.NET MVP
http://www.markrae.net


Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.