access key

Discussion in 'ASP .Net' started by Claudia Fong, Sep 12, 2007.

  1. Claudia Fong

    Claudia Fong Guest

    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

    *** Sent via Developersdex http://www.developersdex.com ***
     
    Claudia Fong, Sep 12, 2007
    #1
    1. Advertising

  2. On Sep 12, 11:51 am, Claudia Fong <> wrote:
    > Just trying to avoid user clicking on that button accidentaly
    >


    Simply add an alert on click:

    <asp:button ... OnClientClick="return confirm('Are you sure?');"
     
    Alexey Smirnov, Sep 12, 2007
    #2
    1. Advertising

  3. "Claudia Fong" <> wrote in message
    news:...

    > <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?sour..._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?');" />


    --
    Mark Rae
    ASP.NET MVP
    http://www.markrae.net
     
    Mark Rae [MVP], Sep 12, 2007
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Christian Bongiorno

    custom key and hasmap using a ranged key

    Christian Bongiorno, Jun 15, 2004, in forum: Java
    Replies:
    1
    Views:
    473
    Roedy Green
    Jun 15, 2004
  2. Patrick Guio
    Replies:
    6
    Views:
    3,267
    chris
    Oct 20, 2004
  3. shyam
    Replies:
    8
    Views:
    452
    Priscilla Walmsley
    Jun 21, 2006
  4. Florian Lindner

    key - key pairs

    Florian Lindner, Jun 23, 2005, in forum: Python
    Replies:
    8
    Views:
    589
    Paul McGuire
    Jun 24, 2005
  5. M P
    Replies:
    1
    Views:
    556
Loading...

Share This Page