I have a web application that is a quiz and includes a timer. When the a timeleft variable becomes becomes zero a label's text is changed to "Time Is Up". However I also have a user control that I want to open up which is like a dioalog box that tells the user
that the time is up. At the moment I can only get the user control to become visible when I do a postback by clicking a "postback" button. Is there a way to programatically in VB code behind to do a postback when the time is up making it unneccessary for a
manual click of a button. If so can you outline the VB code and any parameters needed. Also indicate if any markup is needed in the aspx page file. Thanks for any help bobthebuilder
Try using the Timer control located under the AJAX Extensions tab in the VS Toolbox. While it was added to work with AJAX controls, it should work for this as well.
I have used the timer control placing the User Contol Dialog in an Update Panel. This then enables the dialog to be opened automatically when the time has elapsed. But that creates another problem. Beacuse the User Control Dialog is in the Update Panel it
cannot affect other parts of the page outside the Update Panel. As the user click the close button on the User Control I want it to run procedures to update things on my page that are not in the update pane.
It still seems to me that clicking a button programatically in code behind (to force a postback) would be best so that the whole page can be updated. Have you any ideas? Thanks Bob Bown
Bob Bown
Member
4 Points
4 Posts
vb coding a postback without clicking a button
Jan 18, 2012 03:43 AM|LINK
I have a web application that is a quiz and includes a timer. When the a timeleft variable becomes becomes zero a label's text is changed to "Time Is Up". However I also have a user control that I want to open up which is like a dioalog box that tells the user that the time is up. At the moment I can only get the user control to become visible when I do a postback by clicking a "postback" button. Is there a way to programatically in VB code behind to do a postback when the time is up making it unneccessary for a manual click of a button. If so can you outline the VB code and any parameters needed. Also indicate if any markup is needed in the aspx page file. Thanks for any help bobthebuilder
Careed
All-Star
18764 Points
3637 Posts
Re: vb coding a postback without clicking a button
Jan 18, 2012 06:12 AM|LINK
Try using the Timer control located under the AJAX Extensions tab in the VS Toolbox. While it was added to work with AJAX controls, it should work for this as well.
http://msdn.microsoft.com/library/system.web.ui.timer.aspx
"The oxen are slow, but the earth is patient."
Bob Bown
Member
4 Points
4 Posts
Re: vb coding a postback without clicking a button
Jan 24, 2012 04:44 AM|LINK
I have used the timer control placing the User Contol Dialog in an Update Panel. This then enables the dialog to be opened automatically when the time has elapsed. But that creates another problem. Beacuse the User Control Dialog is in the Update Panel it cannot affect other parts of the page outside the Update Panel. As the user click the close button on the User Control I want it to run procedures to update things on my page that are not in the update pane.
It still seems to me that clicking a button programatically in code behind (to force a postback) would be best so that the whole page can be updated. Have you any ideas? Thanks Bob Bown
Careed
All-Star
18764 Points
3637 Posts
Re: vb coding a postback without clicking a button
Jan 25, 2012 02:49 AM|LINK
Using the Timer control outside of any UpdatePanel control will initiate a normal postback for your page with the time elapses.
"The oxen are slow, but the earth is patient."