473,396 Members | 1,998 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,396 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 3292
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.