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
grd_Cases.DataSource = Ds_SLAApp1.tbl_Cases
Label1.Text = "done"
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?