Disabling button control event.

Discussion in 'ASP .Net Web Controls' started by peli, Dec 18, 2003.

  1. peli

    peli Guest

    Hi,,

    I want to disable a button control event after first clicked.
    The reason is that when the button is clicked, a dataset which holds data
    accesses database to save data.
    If button is clicked twice, the same data is stored twice. Therefore I want
    to disable the button immediately after a client clicked.

    Does anyone know about this?
    Would you teach me?

    Thanks.

    peliz
    peli, Dec 18, 2003
    #1
    1. Advertising

  2. hi peliz, there is no automatic way to achieve what you want. You could use
    various workarounds, but the easiest way around this would be to use this
    free web server control provided by andy smith.

    http://www.metabuilders.com/Tools/OneClick.aspx

    "peli" <> wrote in message
    news:uIytd$...
    > Hi,,
    >
    > I want to disable a button control event after first clicked.
    > The reason is that when the button is clicked, a dataset which holds data
    > accesses database to save data.
    > If button is clicked twice, the same data is stored twice. Therefore I

    want
    > to disable the button immediately after a client clicked.
    >
    > Does anyone know about this?
    > Would you teach me?
    >
    > Thanks.
    >
    > peliz
    >
    >
    Alessandro Zifiglio, Dec 18, 2003
    #2
    1. Advertising

  3. peli

    susie Guest

    In your save button click event, add the following code:
    yourButton.enabled=false

    >-----Original Message-----
    >hi peliz, there is no automatic way to achieve what you

    want. You could use
    >various workarounds, but the easiest way around this

    would be to use this
    >free web server control provided by andy smith.
    >
    >http://www.metabuilders.com/Tools/OneClick.aspx
    >
    >"peli" <> wrote in message
    >news:uIytd$...
    >> Hi,,
    >>
    >> I want to disable a button control event after first

    clicked.
    >> The reason is that when the button is clicked, a

    dataset which holds data
    >> accesses database to save data.
    >> If button is clicked twice, the same data is stored

    twice. Therefore I
    >want
    >> to disable the button immediately after a client

    clicked.
    >>
    >> Does anyone know about this?
    >> Would you teach me?
    >>
    >> Thanks.
    >>
    >> peliz
    >>
    >>

    >
    >
    >.
    >
    susie, Dec 18, 2003
    #3
  4. peli

    peli Guest

    This is excellent.
    Thank you very much

    peliz.

    "Alessandro Zifiglio" <> wrote in
    message news:p5fEb.18028$...
    > hi peliz, there is no automatic way to achieve what you want. You could

    use
    > various workarounds, but the easiest way around this would be to use this
    > free web server control provided by andy smith.
    >
    > http://www.metabuilders.com/Tools/OneClick.aspx
    >
    > "peli" <> wrote in message
    > news:uIytd$...
    > > Hi,,
    > >
    > > I want to disable a button control event after first clicked.
    > > The reason is that when the button is clicked, a dataset which holds

    data
    > > accesses database to save data.
    > > If button is clicked twice, the same data is stored twice. Therefore I

    > want
    > > to disable the button immediately after a client clicked.
    > >
    > > Does anyone know about this?
    > > Would you teach me?
    > >
    > > Thanks.
    > >
    > > peliz
    > >
    > >

    >
    >
    peli, Dec 18, 2003
    #4
  5. YOu cant disable the button like that.
    Peliz, maybe i should have said this earlier but if you dont plan to use
    that custom control then you might just want to wrap your code within an if
    block checking against a session variable or viewstate on whether it is
    already set and if false to execute the code and set the viewstate this way
    subsequent clicks will fail
    like :
    if (ViewState("FirstRound") is nothing) then
    'execute code and insert/update/delete from db
    'after successfull execution set the viewstate
    viewstate("FirstRound") = "OK"
    else
    'code already been executed so do something else or do nothing at all ;)
    response.redirect("nextpage.aspx")
    End if

    or place the logic in your stored proc, that is check to see if the record
    has already been added/deleted/updated and if so do nothing, this should be
    fairly easy to achieve ;)

    The stuff with the viewstate I havent really tested, its off the top of my
    head but makes sense so give it a shot ;)
    "susie" <> wrote in message
    news:0b2701c3c5ab$748f8c70$...
    >
    > In your save button click event, add the following code:
    > yourButton.enabled=false
    >
    > >-----Original Message-----
    > >hi peliz, there is no automatic way to achieve what you

    > want. You could use
    > >various workarounds, but the easiest way around this

    > would be to use this
    > >free web server control provided by andy smith.
    > >
    > >http://www.metabuilders.com/Tools/OneClick.aspx
    > >
    > >"peli" <> wrote in message
    > >news:uIytd$...
    > >> Hi,,
    > >>
    > >> I want to disable a button control event after first

    > clicked.
    > >> The reason is that when the button is clicked, a

    > dataset which holds data
    > >> accesses database to save data.
    > >> If button is clicked twice, the same data is stored

    > twice. Therefore I
    > >want
    > >> to disable the button immediately after a client

    > clicked.
    > >>
    > >> Does anyone know about this?
    > >> Would you teach me?
    > >>
    > >> Thanks.
    > >>
    > >> peliz
    > >>
    > >>

    > >
    > >
    > >.
    > >
    Alessandro Zifiglio, Dec 18, 2003
    #5
  6. YOu cant disable the button like that.
    Peliz, maybe i should have said this earlier but if you dont plan to use
    that custom control then you might just want to wrap your code within an if
    block checking against a session variable or viewstate on whether it is
    already set and if false to execute the code and set the viewstate this way
    subsequent clicks will fail
    like :
    if (ViewState("FirstRound") is nothing) then
    'execute code and insert/update/delete from db
    'after successfull execution set the viewstate
    viewstate("FirstRound") = "OK"
    else
    'code already been executed so do something else or do nothing at all ;)
    response.redirect("nextpage.aspx")
    End if

    or place the logic in your stored proc, that is check to see if the record
    has already been added/deleted/updated and if so do nothing, this should be
    fairly easy to achieve ;)

    The stuff with the viewstate I havent really tested, its off the top of my
    head but makes sense so give it a shot ;)
    "susie" <> wrote in message
    news:0b2701c3c5ab$748f8c70$...
    >
    > In your save button click event, add the following code:
    > yourButton.enabled=false
    >
    > >-----Original Message-----
    > >hi peliz, there is no automatic way to achieve what you

    > want. You could use
    > >various workarounds, but the easiest way around this

    > would be to use this
    > >free web server control provided by andy smith.
    > >
    > >http://www.metabuilders.com/Tools/OneClick.aspx
    > >
    > >"peli" <> wrote in message
    > >news:uIytd$...
    > >> Hi,,
    > >>
    > >> I want to disable a button control event after first

    > clicked.
    > >> The reason is that when the button is clicked, a

    > dataset which holds data
    > >> accesses database to save data.
    > >> If button is clicked twice, the same data is stored

    > twice. Therefore I
    > >want
    > >> to disable the button immediately after a client

    > clicked.
    > >>
    > >> Does anyone know about this?
    > >> Would you teach me?
    > >>
    > >> Thanks.
    > >>
    > >> peliz
    > >>
    > >>

    > >
    > >
    > >.
    > >
    Alessandro Zifiglio, Dec 18, 2003
    #6
    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. Purvi T
    Replies:
    0
    Views:
    831
    Purvi T
    Oct 19, 2004
  2. jorge
    Replies:
    2
    Views:
    1,265
    jorge
    May 26, 2004
  3. Replies:
    2
    Views:
    774
    Jonathan N. Little
    May 15, 2008
  4. mrjava
    Replies:
    0
    Views:
    576
    mrjava
    Aug 4, 2008
  5. Mike Lambert

    disabling button control on grid.

    Mike Lambert, Oct 20, 2003, in forum: ASP .Net Datagrid Control
    Replies:
    1
    Views:
    105
    Saravana [MVP]
    Oct 21, 2003
Loading...

Share This Page