Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > Disabling button control event.

Reply
Thread Tools

Disabling button control event.

 
 
peli
Guest
Posts: n/a
 
      12-18-2003
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


 
Reply With Quote
 
 
 
 
Alessandro Zifiglio
Guest
Posts: n/a
 
      12-18-2003
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
>
>



 
Reply With Quote
 
 
 
 
susie
Guest
Posts: n/a
 
      12-18-2003

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
>>
>>

>
>
>.
>

 
Reply With Quote
 
peli
Guest
Posts: n/a
 
      12-18-2003
This is excellent.
Thank you very much

peliz.

"Alessandro Zifiglio" <> wrote in
message news5fEb.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
> >
> >

>
>



 
Reply With Quote
 
Alessandro Zifiglio
Guest
Posts: n/a
 
      12-18-2003
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
> >>
> >>

> >
> >
> >.
> >



 
Reply With Quote
 
Alessandro Zifiglio
Guest
Posts: n/a
 
      12-18-2003
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
> >>
> >>

> >
> >
> >.
> >





 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
disabling the ENTER button to trigger a button? paul814@excite.com HTML 2 05-15-2008 03:28 PM
Responding to Button control events when Button is added to a Table Control Jim Gilligan ASP .Net Web Controls 0 09-01-2005 06:29 PM
disabling button control on grid. Mike Lambert ASP .Net Datagrid Control 1 10-21-2003 03:43 AM
Re: Disabling second submit by hitting browser Refresh button Kevin Spencer ASP .Net 2 08-30-2003 07:10 AM
Disabling a button but calling its server code Paul ASP .Net 4 08-01-2003 07:26 PM



Advertisments