?
Solved

data not refreshing on timer event

Posted on 2003-03-09
7
Medium Priority
?
639 Views
Last Modified: 2012-05-04
I have an ASP.NET (VB.NET) project with a Webform that contains a connection to a database and a grid displaying the results of a query. I want to refresh the displayed results every 10 minutes.

So I used a Timer control with the following event handler:
Private Sub Timer1_Elapsed(ByVal sender As System.Object, ByVal e As System.Timers.ElapsedEventArgs) Handles tmr_Refresh.Elapsed
        'refresh data
        Stop
        Ds_SLAApp1.tbl_Cases.Clear()
        dta_Cases.Fill(Ds_SLAApp1)
        grd_Cases.DataSource = Ds_SLAApp1.tbl_Cases
        grd_Cases.DataBind()
        Label1.Text = "done"
End Sub

I set the properties of the timer to the following:
interval=10000 '10 seconds
Autoreset=false 'trigger once only

I inserted the stop so that I can see if the event actually fires, then I trace through the rest of the sub.

The problem is that as soon as the ".Fill" method is called, the sub is terminated (like an "Exit Sub") and non of the rest of the instructions are executed!

At this stage I am guessing that the timer event is not server-side, and does not cause a postback to the server (something that I would probably need for my code to work).

How can I get the event to execute correctly, or get it to do a postback to the server, so that I can do the refresh of the data on the page_load event or something like that?
0
Comment
Question by:SADiver
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 20

Expert Comment

by:Silvers5
ID: 8102177
it should be a client side script, try to refresh thru a meta tag...
code in 10 seconds
0
 
LVL 20

Accepted Solution

by:
Silvers5 earned 1000 total points
ID: 8102202
add this in the html part of your aspx document.. in the header:

<META HTTP-EQUIV=Refresh CONTENT="10; URL=yourpage.aspx">
tells the browser to load yourpage.aspx 10 seconds after the current document has finished loading
0
 
LVL 23

Expert Comment

by:naveenkohli
ID: 8102209
The server side timer is not the way to go. It is not going to refresh the client browser. ASP.Net is a server side technology. To accomplish this,

1. Add REFRESH meta tag at top of your page..
HEAD>
<TITLE>Auto Refresh Page Example</TITLE>
<META HTTP-EQUIV="Refresh" CONTENT="60">
</HEAD>


0
Quiz: What Do These Organizations Have In Common?

Hint: Their teams ended up taking quizzes, too.

 
LVL 20

Expert Comment

by:Silvers5
ID: 8102212
well 10 minutes will be a value of 600
0
 
LVL 20

Expert Comment

by:Silvers5
ID: 8102222
:o) Speed counts...
0
 

Author Comment

by:SADiver
ID: 8108621
Excellent, this resolved the problem!

Now, Could I ask that if someone knows why the origenal method doesn't work, that you please post that here as well?

There must be a reason for putting the Timer control in ASP.NET. What is it's function and how are you supposed to use it?

"Silvers5", Thanks a mil for the help!
0
 
LVL 1

Expert Comment

by:Ghis68
ID: 13071546
I am trying to do the samething has you.  I only want to refresh the data portion of the WEB page so the page is not reload and does not flash. The Meta is working like they mention but it need to be a way to do exactly what you want.  If you have found it please let me know.

I know what I am writting will not help but it will allow me to trace your question so if I found the answer I let you know

thanks
0

Featured Post

Congratulations! You’re Certified – Now What?

Starting a new career can be overwhelming. Becoming certified in your field of expertise is a great start, but where do you go from here?  Here are some tips to help you on your career journey.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Flash (http://en.wikipedia.org/wiki/Adobe_Flash) has evolved over the years to where it has become a masterful tool for displaying content screen.  It has excellent layout placement, UI precision as well as rendering capabilities. This, along with t…
A basic question.. “What is the Garbage Collector?” The usual answer given back: “Garbage collector is a background thread run by the CLR for freeing up the memory space used by the objects which are no longer used by the program.” I wondered …
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question