Can the timer be used to submit a web page?

  • Thread starter Thread starter Matthew Speed
  • Start date Start date
M

Matthew Speed

I want to make a page that automatically refreshes every minute. I
can drag the timer control onto my page but I can't figure out what
code to write to tell the page to postback to the server. How do I do
this?

TIA
 
not the right group to ask this
but...

you can use this
<META HTTP-EQUIV="REFRESH" CONTENT="60">

or you can use javascript...
 
Hi Matthew,

Thanks for posting in the community.

First of all, I would like to confirm my understanding of your issue.
From your description, I understand that you wants to make a page which
automatically refreshes every minute.
Have I fully understood you? If there is anything I misunderstood, please
feel free to let me know.

The web application uses the pull model. That is the client post the
request to the server. The server processes the request, and returns the
result to the client. While the timer control works at server side, it will
not push data to the client actively without client side's request.

I agree with Dominique's suggestion.
Here I write a sample for you.
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
If Not IsPostBack Then
If Not (Session("DoAutoRefresh") Is Nothing) Then
If CBool(Session("DoAutoRefresh")) = True Then
CheckBox1.Checked = True
Response.Write("<meta http-equiv=""Refresh"" content =
""60"">") '
End If '
End If
End If
Dim rd As Random = New Random
Response.Write(rd.Next().ToString())
End Sub

Private Sub CheckBox1_CheckedChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged
If Session("DoAutoRefresh") Is Nothing Then
CheckBox1.Checked = True
Session("DoAutoRefresh") = True
Response.Write("<meta http-equiv=""Refresh"" content =
""60"">") '
Else
If CBool(Session("DoAutoRefresh")) = False Then
CheckBox1.Checked = True
Session("DoAutoRefresh") = True
Response.Write("<meta http-equiv=""Refresh"" content =
""60"">") '
Else
CheckBox1.Checked = False
Session("DoAutoRefresh") = False
End If
End If
End Sub


Please Apply My Suggestion Above And Let Me Know If It Helps Resolve Your
Problem.


Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 
Thank you both for your response. You did understand the question
completely. I wanted to make a web page to watch some values in a
database. I wanted the screen to automatically refresh every 60
seconds to show me when those values changed.

Unfortunately, I already knew how to write the Javascript code. I am
attempting, wherever possible, to use exclusively VB.Net code to
accomplish my web programming, mostly as an exercise to see where the
limitations of VB.Net as a web development tool are and where I have
to resort to other technologies.

It was my hope that VB.Net would be smart enough to give me a postback
method for the page that on compilation would produce the refresh code
without me having to do it.

I guess not.
 
Hi Matthew,

Thanks for your quickly reply!

As I said in my last post, the Browse/Server modal is based on pull model
not push model for security concern. That is to say the work principle is
browser send request, and the Server response.

So the server will not and should not push data to tell the client browser
to refresh the page.
As for your concern on VB.NET to provide the feature to produce the auto
refrest code, you may try to submit a wish to out mswish website.

Microsoft offers several ways for you to send comments or suggestions about
Microsoft products. If you have suggestions for product enhancements that
you would like to see in future versions of Microsoft products, please
contact us using one of the methods listed later in this article.

Let us know how we can improve our products.

Product Enhancement suggestions can include:

" Improvements on existing products.
" Suggestions for additional features.
" Ways to make products easier to use.

World Wide Web - To send a comment or suggestion via the Web, use one of
the following methods:

" In Internet Explorer 6, click Send Feedback on the Help menu and then
click the link in the Product Suggestion section of the page that appears.
" In Windows XP, click Help and Support on the Start menu. Click Send your
feedback to Microsoft, and then fill out the Product Suggestion page that
appears.
" Visit the following Microsoft Web site: http://www.microsoft.com/ms.htm
" Click Microsoft.com Guide in the upper-right corner of the page and then
click Contact Us . Click the link in the Product Suggestion section of the
page that appears.
" Visit the following Microsoft Product Feedback Web site:
"http://register.microsoft.com/mswish/suggestion.asp" and then complete and
submit the form.

E-mail - To send comments or suggestions via e-mail, use the following
Microsoft Wish Program e-mail address, (e-mail address removed).
FAX - To send comments or suggestions via FAX, use the following Microsoft
FAX number, (425) 936-7329.

Each product suggestion is read by a member of our product feedback team,
classified for easy access, and routed to the product or service team to
drive Microsoft product and/or service improvements. Because we receive an
abundance of suggestions (over 69,000 suggestions a year!) we can't
guarantee that each request makes it into a final product or service. But
we can tell you that each suggestion has been received and is being
reviewed by the team that is most capable of addressing it.

All product or service suggestions received become the sole property of
Microsoft. Should a suggestion be implemented, Microsoft is under no
obligation to provide compensation.



Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 
Hi Matthew,

Strange Peter was not pointing you on this because as far as I remember me I
got it from a message he had sended in to this newsgroup.

Did yuo look what
RegisterStartupScript("Startup", javascriptstring)

Can do for you?

Cor
 
Hi Matthew,

In ASP.NET application(you may write the code in VB.NET), the webform is a
web page which was render out by the code behind. When the browse navigated
to the page, the browse will send a request to the web server(e.g. IIS),
the IIS will response a webpage(it is the html code and javascript and
else). So the timer in Server side will not affect the client side, also
the server will not and should not request the client to retrieve a page
from server. So after the browser get the page from the server side, the
brower will parse and execute the code in the reponse page.

Did I answer your question?
If you have any concern on this issue, please post here.

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 
Back
Top