Using VB.Net - how to record the time of each client side button click

I have a web app and I need to capture the click time of each button click without doing a post-back on each click. Once I capture these times, I would then like to store in DB.

The webform has 5 dynamically created buttons. Each button is used like a ranking mechanism. So on the form - a question would be asked like: Which one do you like the most? 1) Cookies, 2) Cake, 3) Ice Cream, 4) Hamburger or 5) Hot Dog..

I need for the user to rank each option but record click time of each (not for display but for storing in DB)
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Kyle AbrahamsSenior .Net DeveloperCommented:
you would have to do it in javascript.

Create a hidden text field:

then use the javascript to append the text:

<script type="text/javascript">

    //Get the current date and time stamp.
   function appendText (sender)
    var date =;
    var TheTextBox = document.getElementById("Mytextbox");  // you can also use <%MyTextbox.ClientID %> if you're in a content page
    TheTextBox.value = TheTextBox.value + sender.ID + " " + date;

Open in new window

then your buttons would be:

<asp:Button  ID="CookieButton" OnClientClick="appendText(this);" />
JReamAuthor Commented:
I was able to obtain the button click times with each click displayed within an alert message box (as a test) but my main issue is storing those java-script button click times to a variable that I can use in for further manipulation (ie: save to DB)
Kyle AbrahamsSenior .Net DeveloperCommented:
Create another textbox, visible for now.

Append the text to this new textbox (rather than the alert)

when you finally post back, the server will have access to the text in the textbox, which can then be saved.

when you're finally all done,
style="display:none" (NOT visible = false)  on the textbox to hide the textbox from the user.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.