Okay, you only want to have this timeout execute once, right? Well, first of
all, you don't need to do any checking on the server. The client side will
submit the form when the time is up. Second, since you only want to start
the timer once, when the test starts, you don't want to put the JavaScript
into the onload attribute of the body. When you are ready to start the test,
from the server side, add the timeout JavaScript to the page using
Page.RegisterStartupScript(). Only do this when the user is ready to start
the test. Put a hidden form field into the form, and set it to a blank
value. The client-side script will put a string into the hidden form field
before it submits the form. All you have to do on the server side is check
the hidden form field whenever the Page is Posted Back. If the value of the
hidden form field is not blank, the timer posted the Page back, so you can
submit the answers.
--
HTH,
Kevin Spencer
Microsoft MVP
..Net Developer
You can lead a fish to a bicycle,
but it takes a very long time,
and the bicycle has to *want* to change.