Handle Double-click on <Input type="image">

Discussion in 'ASP .Net' started by Will, Mar 13, 2008.

  1. Will

    Will Guest

    I have an image "button" which causes a postback.

    I handle the "click" with

    If Request.Form("btnBU7WD6_Submit.X") > 0 Then...

    this works great. However, when a user double-clicks the image button the
    Page_Load (postback) is processed twice. This is a problem.

    Is there any easy way to detect that the image button has been double-cliked
    and posted back twice?

    --
    -Will
     
    Will, Mar 13, 2008
    #1
    1. Advertising

  2. Try creating a boolean Session Item at thee end of the click handler method
    , and check for its presence before handling any subsequent clicks. If the
    session item is not null at the beginning of the click handler method body,
    that means it was already clicked.
    -- Peter
    Site: http://www.eggheadcafe.com
    UnBlog: http://petesbloggerama.blogspot.com
    Short Urls & more: http://ittyurl.net


    "Will" wrote:

    > I have an image "button" which causes a postback.
    >
    > I handle the "click" with
    >
    > If Request.Form("btnBU7WD6_Submit.X") > 0 Then...
    >
    > this works great. However, when a user double-clicks the image button the
    > Page_Load (postback) is processed twice. This is a problem.
    >
    > Is there any easy way to detect that the image button has been double-cliked
    > and posted back twice?
    >
    > --
    > -Will
     
    Peter Bromberg [C# MVP], Mar 13, 2008
    #2
    1. Advertising

  3. Will

    Will Guest

    Thanks Peter. That's the solution I planned on going with.

    I was hoping there was a way to detect it in the Postback, but I don't see
    anything.

    Thanks
    --
    -Will


    "Peter Bromberg [C# MVP]" wrote:

    > Try creating a boolean Session Item at thee end of the click handler method
    > , and check for its presence before handling any subsequent clicks. If the
    > session item is not null at the beginning of the click handler method body,
    > that means it was already clicked.
    > -- Peter
    > Site: http://www.eggheadcafe.com
    > UnBlog: http://petesbloggerama.blogspot.com
    > Short Urls & more: http://ittyurl.net
    >
    >
    > "Will" wrote:
    >
    > > I have an image "button" which causes a postback.
    > >
    > > I handle the "click" with
    > >
    > > If Request.Form("btnBU7WD6_Submit.X") > 0 Then...
    > >
    > > this works great. However, when a user double-clicks the image button the
    > > Page_Load (postback) is processed twice. This is a problem.
    > >
    > > Is there any easy way to detect that the image button has been double-cliked
    > > and posted back twice?
    > >
    > > --
    > > -Will
     
    Will, Mar 13, 2008
    #3
  4. Will

    Jeff Dillon Guest

    Disable the button client side onclick?

    "Will" <> wrote in message
    news:...
    > Thanks Peter. That's the solution I planned on going with.
    >
    > I was hoping there was a way to detect it in the Postback, but I don't see
    > anything.
    >
    > Thanks
    > --
    > -Will
    >
    >
    > "Peter Bromberg [C# MVP]" wrote:
    >
    >> Try creating a boolean Session Item at thee end of the click handler
    >> method
    >> , and check for its presence before handling any subsequent clicks. If
    >> the
    >> session item is not null at the beginning of the click handler method
    >> body,
    >> that means it was already clicked.
    >> -- Peter
    >> Site: http://www.eggheadcafe.com
    >> UnBlog: http://petesbloggerama.blogspot.com
    >> Short Urls & more: http://ittyurl.net
    >>
    >>
    >> "Will" wrote:
    >>
    >> > I have an image "button" which causes a postback.
    >> >
    >> > I handle the "click" with
    >> >
    >> > If Request.Form("btnBU7WD6_Submit.X") > 0 Then...
    >> >
    >> > this works great. However, when a user double-clicks the image button
    >> > the
    >> > Page_Load (postback) is processed twice. This is a problem.
    >> >
    >> > Is there any easy way to detect that the image button has been
    >> > double-cliked
    >> > and posted back twice?
    >> >
    >> > --
    >> > -Will
     
    Jeff Dillon, Mar 13, 2008
    #4
    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. Dietrich
    Replies:
    1
    Views:
    648
    Joe Smith
    Jul 22, 2004
  2. Sydex
    Replies:
    12
    Views:
    6,507
    Victor Bazarov
    Feb 17, 2005
  3. Replies:
    0
    Views:
    374
  4. Roberto
    Replies:
    3
    Views:
    312
  5. Csaba2000
    Replies:
    4
    Views:
    159
    Roman Bystritskiy
    Nov 25, 2003
Loading...

Share This Page