Forcing PostBack programmitically

  • Thread starter Thread starter Guest
  • Start date Start date
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)
 
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)
 
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.
 
Back
Top