We help IT Professionals succeed at work.

Use a button to reset counter

ratkinso666
ratkinso666 asked
on
367 Views
Last Modified: 2013-11-26
Hi all, I need to have a button that will reset a counter, I need both the button and the counter in the grid, so there will be like 6 of them running at a time, like you would see in an auction.  So when the person pushes the button, it needs to reset the counter, not only for the person who pushed the button, but for anyone else looking at the grid.  I'm not sure how to do all of this??  I can make a simple button and counter that gets reset by it, but not sure how to put it in the grid and would it have to be server side, so that it can update the counter for anyone else looking at it??  I am using VS 2008 VB, do I have to do it in JavaScript or what, do I have to have the computers on the website refresh once a second, so they can keep up with the counters?? really not sure which direction I need to head on this.

Thanks,
Randy
Comment
Watch Question

Welcome to the problems of web development!
Tell me more about your application in general.

Author

Commented:
Well, I, perhaps foolishly, told my church that I thought I could help them setup an online auction, I have most of it figured out, but when it comes to the button, I can track WHO is placing the bid, WHAT they bid on, etc, etc., but not sure how to add a timer and make it so that I have the auction timer reset when the button is pressed and so that anyone on the auction sees it reset.  I have everything in a Datalist currently.  
Thank you for any help you can give!!
Foremost simple solution would be like in ebay or stock ticker sites.
Refresh the page and read the counter from database.
Other option is to go for Ajax where the user doesnt realized that there is a server processing.AJAX is the hot one  to look for

Author

Commented:
I would like to do it in AJAX, but not sure how to start it out??  AJAX doesn't have a timer, so not sure how I would set that in the database so that I could read it into my gridview....  and have like 6 independent ones...
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION

Author

Commented:
Thank you spprivate, that does tell me how to refresh my grid every second, so that the current time remaining displays.  But is the timer supposed to display the time remaining, I don't see how it does, from what I can see, is all it will do is refresh my update panel, which is useful, but still doesn't show a timer.  I can see that I could create fields in my database for hours, minutes and seconds and refresh those in a label maybe??  To show the countdown...  Is that what I would need to do and then that therefore would display a timer, not sure if that is the best way to do, since that would be a LOT of refreshing and traffic.  If that is how I would do it, then how would I make the time update in the database?  Hope that makes sense...

Thank you VERY much
You want to show a timer or ticking clock kind of thing in the page to all the users.that should be reset once a button is clicked.Correct

Author

Commented:
yes, that is correct, in a grid for each item, so I could have 6 different clocks running at the same time, but only one at a time gets reset.
Here is an example of timer control in ajax

http://www.codeproject.com/KB/webforms/ServerSideClock.aspx

Here if you look in the last part

"Setting logick on Tick event Here we dont have to do much. just set current date time value to label void timer_Tick(object sender, EventArgs e)"

Where he sets the time,read the time from the database table.
The reset button in the control form would update that table everytime when reset button in clicked

Author

Commented:
I will work on it with the info you gave me, but it will take me some time and experimenting to figure out how that is working.
Thanks

Author

Commented:
I've been working with this, but unless I am just not getting it correct, which is VERY possible, it only seems to do time, rather than a timer...  I need something that is set to like say 3:00 minutes and starts counting down, unless someone hits the bid button and then it will add like 30 seconds to whatever time is remaining.  I can set up the hours, minutes and seconds in the database, but then unless someone hits the button it will not change, so I need to be able to change the time in the database even when no one is hitting any buttons..  hope that makes sense...  I know it can be done I have seen it on other sites, just not sure how...

thanks,
randy
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.