Forcing PostBack programmitically

G

Guest

Hi,
I'm doing an online examination page. After the alloted time of the exam the page should be posted back. I've used System.Timers namespace for timekeeping. Please help me post back the form in 'Elapsed event' of the timer object. (i m using ASP.net with VB.net)
 
T

Teemu Keiski

You'd need to do timing at client. Causing postback is quite easy, just
output a __doPostBack call that is called when timeout is elapsed. You'll
get that done by using Page.GetPostBackEventReference method (it returns you
the javascript call to cause a postback in behalf of given control), then
just output the call and wrap it into js code on the client-side HTML to get
called after time is elapsed. IIRC, js has setTimeout method or something
similar. Unless js isn't robust enough, I think you'd need to use richer
client stuff (maybe Flash or even applet)

--
Teemu Keiski
MCP, Microsoft MVP (ASP.NET), AspInsiders member
ASP.NET Forum Moderator, AspAlliance Columnist
http://blogs.aspadvice.com/joteke



Tabrez said:
Hi,
I'm doing an online examination page. After the alloted time of the exam
the page should be posted back. I've used System.Timers namespace for
timekeeping. Please help me post back the form in 'Elapsed event' of the
timer object. (i m using ASP.net with VB.net)
 
G

Guest

Well thanx for the elagant answer, it works when I provide a static time period in the setTimeOut function. But now consider this I have different test with different exam duration in the database. Supposing that I retrieve the test-type and its time duration and attach it to the query string of the questionpaper.aspx url. Now how should I retrieve it on client side with javascript. I've tried it in the following manner but it does not seem to work. I get an empty querystring ETime

<body onload="return Window_Load('<%=request("ETime")%>'))" background=images/regbg.gif >

Note: I apologise for multiple postings, that was because whenever I posted I recieved "could not post" error message when in fact it had.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top