473,378 Members | 1,578 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,378 software developers and data experts.

Timer in ASP.Net

HI all,

I want to implement this scenario: I need my ASP.NET website to
check a SQL table every 30 seconds and if there is a change to display
a message to user. I have created a panel control (pnlMessage) and
placed the message on it also made it default to visible = false. I
have placed a Timer control on my ASP.NET Web Form and set its Interval
= 30000 (30 seconds) it fires ok every 30 seconds and the code executes
it hits the line pnlMessage.visible = True but the panel doesnt
display. When I am debuging it also seems like the timer is still
runnig regardles of me debugging and also all my cookies seems to be
not readable any more. I think i am not using this control correctly
can someone give me an example pls?

Nov 19 '05 #1
5 2166
This is not exactly answer to your question, but is it possible to use more
simple approach:
<meta http-equiv="refresh" content="30">

"csgraham74" wrote:
HI all,

I want to implement this scenario: I need my ASP.NET website to
check a SQL table every 30 seconds and if there is a change to display
a message to user. I have created a panel control (pnlMessage) and
placed the message on it also made it default to visible = false. I
have placed a Timer control on my ASP.NET Web Form and set its Interval
= 30000 (30 seconds) it fires ok every 30 seconds and the code executes
it hits the line pnlMessage.visible = True but the panel doesnt
display. When I am debuging it also seems like the timer is still
runnig regardles of me debugging and also all my cookies seems to be
not readable any more. I think i am not using this control correctly
can someone give me an example pls?

Nov 19 '05 #2
Because of the disconnected state of web apps, this is a tricky problem. Ajax
(Asynch JavqaScript and XML) might be a solution (poll without refreshing the
entire page) as would a page refresh (META tag will work here). With 2.0, you
have the ability to send out a message when data is stale, which works
extremely well in SQL Server 2005 (both due out Nov 7), but you still have to
work a bit with the plumbing.

If stale data is a problem due to editing, consider working in concurrency
protection rather than polling, as it is easier to handle and well documented.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***************************
Think Outside the Box!
***************************
"csgraham74" wrote:
HI all,

I want to implement this scenario: I need my ASP.NET website to
check a SQL table every 30 seconds and if there is a change to display
a message to user. I have created a panel control (pnlMessage) and
placed the message on it also made it default to visible = false. I
have placed a Timer control on my ASP.NET Web Form and set its Interval
= 30000 (30 seconds) it fires ok every 30 seconds and the code executes
it hits the line pnlMessage.visible = True but the panel doesnt
display. When I am debuging it also seems like the timer is still
runnig regardles of me debugging and also all my cookies seems to be
not readable any more. I think i am not using this control correctly
can someone give me an example pls?

Nov 19 '05 #3
Seems to me that you are expecting a timer, created on the server side, to
work with the page framework dynamically. You can change the properties of
controls up and including to the PreRender event. Remember, web programming
is disconnected. Your page is already rendered to the browser adn there's
no tie between the server code and the client anymore. This would work in
windows client,but not web forms.

Check out:
http://msdn.microsoft.com/library/de...SpicedAjax.asp

it uses Ajax to poll a database for changes (sample #2). It should set you
on the right track...

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
"csgraham74" <cs********@gmail.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
HI all,

I want to implement this scenario: I need my ASP.NET website to
check a SQL table every 30 seconds and if there is a change to display
a message to user. I have created a panel control (pnlMessage) and
placed the message on it also made it default to visible = false. I
have placed a Timer control on my ASP.NET Web Form and set its Interval
= 30000 (30 seconds) it fires ok every 30 seconds and the code executes
it hits the line pnlMessage.visible = True but the panel doesnt
display. When I am debuging it also seems like the timer is still
runnig regardles of me debugging and also all my cookies seems to be
not readable any more. I think i am not using this control correctly
can someone give me an example pls?

Nov 19 '05 #4
The server cannot raise an event to a client machine because of the
disconnected architecture of the internet.
All communications must be initiated by the client.
Therefore you may want to have the browser request an update every 30
seconds.

Here are some options:

You could use a refresh meta tag
<meta http-equiv="refresh" content="30">

You could use a JavaScript timer to refresh the page every so often:
http://www.crowes.f9.co.uk/Javascript/timer.htm

Dart has a really nice AJAX-based timer control:
http://www.dart.com/LiveTimer.asp

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
"csgraham74" <cs********@gmail.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
HI all,

I want to implement this scenario: I need my ASP.NET website to
check a SQL table every 30 seconds and if there is a change to display
a message to user. I have created a panel control (pnlMessage) and
placed the message on it also made it default to visible = false. I
have placed a Timer control on my ASP.NET Web Form and set its Interval
= 30000 (30 seconds) it fires ok every 30 seconds and the code executes
it hits the line pnlMessage.visible = True but the panel doesnt
display. When I am debuging it also seems like the timer is still
runnig regardles of me debugging and also all my cookies seems to be
not readable any more. I think i am not using this control correctly
can someone give me an example pls?

Nov 19 '05 #5
create a webservice. Add function to webservice to get data you need and in
time interval that you want.
Create a windows forms control that consumes the service and displays the
status.
Using the object tag put the control on the website.

"csgraham74" <cs********@gmail.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
HI all,

I want to implement this scenario: I need my ASP.NET website to
check a SQL table every 30 seconds and if there is a change to display
a message to user. I have created a panel control (pnlMessage) and
placed the message on it also made it default to visible = false. I
have placed a Timer control on my ASP.NET Web Form and set its Interval
= 30000 (30 seconds) it fires ok every 30 seconds and the code executes
it hits the line pnlMessage.visible = True but the panel doesnt
display. When I am debuging it also seems like the timer is still
runnig regardles of me debugging and also all my cookies seems to be
not readable any more. I think i am not using this control correctly
can someone give me an example pls?

Nov 19 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: Manuel Lopez | last post by:
I have a puzzling form timer problem that I didn't experience prior to Access 2003 (though I'm not sure access 2003 is to blame). Here's the situation: a computer has two access 2003 databases on...
6
by: Dan | last post by:
I've created a pocketpc app which has a startup form containing a listview. The form creates an object which in turn creates a System.Threading.Timer. It keeps track of the Timer state using a...
9
by: HL | last post by:
I am using VS 2005 Beta - C# Problem: The Timer fires a few milliseconds before the actual Due-Time Let's say a timer is created in the following manner: System.Threading.Timer m_timer = null;...
7
by: Grahmmer | last post by:
I have a few timers that are added to a form at runtime. I can handle the event fine, but I cannot identify which timer fired. Is there a way to do this? Timer Creation: -------------...
2
by: John David Thornton | last post by:
I've got a Windows Service class, and I put a System.Threading.Timer, and I've coded it as shown below. However, when I install the service and then start it in MMC, I get a peculiar message: ...
12
by: Gina_Marano | last post by:
I have created an array of timers (1-n). At first I just created windows form timers but I read that system timers are better for background work. The timers will just be monitoring different...
8
by: KnighT | last post by:
I have a .net service that runs a System.Threading.Timer. The delegate points to the function that the service should execute when the timer elapses. Problem: The timer is not ticking. I have...
8
by: =?Utf-8?B?RGF2ZSBCb29rZXI=?= | last post by:
I have a Timer that I set to go off once a day, but it frequently fails! In order to debug I would like to be able to check, at any moment, whether the Timer is enabled and when it will next...
11
by: Hotrod2000 | last post by:
I'm quite new to programming but I'm having problems getting a timer to work in visual studio.net I've created a timer on a form, enabled it and then typed the following code (from the mdsn...
16
by: Peter Oliphant | last post by:
Note that although this involves SAPI, it is more a question about Timers and event handlers. I wrote a Speech Recognize handler (SAPI), and put some code in it to enable a Timer. It would not...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.