473,320 Members | 1,979 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Forcing PostBack programmitically

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)
Nov 18 '05 #1
2 3282
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" <Ta****@discussions.microsoft.com> wrote in message
news:12**********************************@microsof t.com...
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)
Nov 18 '05 #2
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.
"Teemu Keiski" wrote:
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" <Ta****@discussions.microsoft.com> wrote in message
news:12**********************************@microsof t.com...
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)

Nov 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Earl Teigrob | last post by:
I have run into a situation where I need to run the !IsPostBack code under one circumstance, even if it is a postback. Something that may complicate matters more is that this is a double postback...
3
by: Ashish | last post by:
Hello All, This is a bit wierd. I have a main page in my webapp that has toolbar to carry out some common operations. Also this main page has an iframe that hosts a page that serves as an...
6
by: G Dean Blake | last post by:
in my aspx app I am writing a stream that works fine but it replaces what is in the client browser window. The code is as follows: .. .. HttpContext.Current.Response.ClearHeaders()...
3
by: Patrick Olurotimi Ige | last post by:
I have a hyperlink below:- <asp:HyperLink ID="Hyperlink2"NavigateUrl='<%#"AddToCart.aspx?productID=" & DataBinder.Eval(Container, "DataItem.ProductID") >Add</asp:HyperLink> And i want to force...
6
by: SkeanDu | last post by:
Ok, here is my problem. I have an aspx page that displays a databound datagrid and in one of the datagrid column headers I have an image that when clicked opens up a modal web dialog (another...
0
by: Fabuloussites | last post by:
Greetings All, here is my situation. i have a master page that has a login user control embedded on it. within the user control there is a multiview. in the default view, the...
1
by: Jeff | last post by:
I assume that this is an easy newby question... How can I conditionally force the code in a "if not page.ispostback sub" to run even if the page is posting back? More specifically, I have a web...
11
by: antonyliu2002 | last post by:
I know that this has been asked and answered thousands of times. As a matter of fact, I know that I need to say If Not Page.IsPostBack Then 'Do something End If for things that needs to be...
3
by: John Morgan | last post by:
I suppose the answer to this is staring me in the face but.... How do I programmatically get a page to post back? The actual situation is that I am using an aspx table control and changing the...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.