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

Timer Component for VB 2005 .aspx page?

I'm creating a website that monitors the status of servers using
My.Computer.Network.Ping. I'm looking for a way to fire off my Ping()
function every second or so. I see a Timer control availalble for Windows
forms but it is not listed for my .ASPX page. Is there such a control?

Thanks.
Jun 2 '06 #1
10 1559
Ryan,

There should be such a control in Atlas, standard you can make it like this.

http://www.vb-tips.com/default.aspx?...b-4d681b3d530a

I hope this helps,
Cor

"Ryan" <Ty****@newsgroups.nospam> schreef in bericht
news:Ow**************@TK2MSFTNGP02.phx.gbl...
I'm creating a website that monitors the status of servers using
My.Computer.Network.Ping. I'm looking for a way to fire off my Ping()
function every second or so. I see a Timer control availalble for Windows
forms but it is not listed for my .ASPX page. Is there such a control?

Thanks.

Jun 3 '06 #2
Hello Ryan,

As for the timer component, I assume that you're going to perform some
constant operations in your ASP.NET application. Is this operation
specific to individual webform page or is a application wide
operations(like a backgroun worker...)? The article Cor has provided
demonstrates how to create javascript client-side timer which will
constantly call a script function in the web page's client-sdie html
document. However, if what you want is a server-side backgroun timer, I
think you would need to create a server-side background worker thread or a
System.Timers.Timer instance to do the work .e.g.

==================
void Application_Start(object sender, EventArgs e)
{
Timer timer = new System.Timers.Timer();

HttpContext.Current.Application["g_timer"] = timer;

timer.Elapsed += new ElapsedEventHandler(this.OnTimedEvent);
timer.Interval = 4000;
timer.Enabled = true;
}
===========================

Regards,

Steven Cheng
Microsoft Online Community Support
==================================================

When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.

==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

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

Jun 5 '06 #3
Thanks Steven, this works. However, I have images on my page showing the
status of the servers being pinged and these images are not being changed on
the fly. My Ping function changes the ImageURL property based on whether
the Ping succeeds or fails (green image for success, red for failure). Do I
have to re-load the entire page just to update a single image or is there
another way to get just that image to update dynamically on the page?

Thanks.
"Steven Cheng[MSFT]" <st*****@online.microsoft.com> wrote in message
news:m8**************@TK2MSFTNGXA01.phx.gbl...
Hello Ryan,

As for the timer component, I assume that you're going to perform some
constant operations in your ASP.NET application. Is this operation
specific to individual webform page or is a application wide
operations(like a backgroun worker...)? The article Cor has provided
demonstrates how to create javascript client-side timer which will
constantly call a script function in the web page's client-sdie html
document. However, if what you want is a server-side backgroun timer, I
think you would need to create a server-side background worker thread or a
System.Timers.Timer instance to do the work .e.g.

==================
void Application_Start(object sender, EventArgs e)
{
Timer timer = new System.Timers.Timer();

HttpContext.Current.Application["g_timer"] = timer;

timer.Elapsed += new ElapsedEventHandler(this.OnTimedEvent);
timer.Interval = 4000;
timer.Enabled = true;
}
===========================

Regards,

Steven Cheng
Microsoft Online Community Support
==================================================

When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.

==================================================
This posting is provided "AS IS" with no warranties, and confers no
rights.

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

Jun 5 '06 #4
Just wanted to add that I know the Ping() function is being called because I
put a msgbox("Ping function called") within the function and it pops up on
the webpage every 2 seconds. All I want to know is how do I change an image
on the page (stored in an Image object). Changing the ImageURL does not
seem to be doing the trick.

Thanks!

"Ryan" <Ty****@newsgroups.nospam> wrote in message
news:OE**************@TK2MSFTNGP05.phx.gbl...
Thanks Steven, this works. However, I have images on my page showing the
status of the servers being pinged and these images are not being changed
on the fly. My Ping function changes the ImageURL property based on
whether the Ping succeeds or fails (green image for success, red for
failure). Do I have to re-load the entire page just to update a single
image or is there another way to get just that image to update dynamically
on the page?

Thanks.
"Steven Cheng[MSFT]" <st*****@online.microsoft.com> wrote in message
news:m8**************@TK2MSFTNGXA01.phx.gbl...
Hello Ryan,

As for the timer component, I assume that you're going to perform some
constant operations in your ASP.NET application. Is this operation
specific to individual webform page or is a application wide
operations(like a backgroun worker...)? The article Cor has provided
demonstrates how to create javascript client-side timer which will
constantly call a script function in the web page's client-sdie html
document. However, if what you want is a server-side backgroun timer, I
think you would need to create a server-side background worker thread or
a
System.Timers.Timer instance to do the work .e.g.

==================
void Application_Start(object sender, EventArgs e)
{
Timer timer = new System.Timers.Timer();

HttpContext.Current.Application["g_timer"] = timer;

timer.Elapsed += new ElapsedEventHandler(this.OnTimedEvent);
timer.Interval = 4000;
timer.Enabled = true;
}
===========================

Regards,

Steven Cheng
Microsoft Online Community Support
==================================================

When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.

==================================================
This posting is provided "AS IS" with no warranties, and confers no
rights.

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


Jun 5 '06 #5
Hello Ryan,

Thanks for your response.

Actually, the background thread or a global Timer approach I mentioned just
provide the capability of executing some background code or tasks. If you
want constantly do some thing and then update a page's UI, I think you'd
better consider Cor's suggestion about use javascript function "setTimeout"
or "setInterval" to execute some script code constantly. And you can use
javascript to update a certain image object's url and that change will take
effect immediately at client-side. e.g.:

var img = document.getElementById("imgTitle");
img.src = "new image url";
If you want to get some certain status info from server-side, you can
consider use xmlhttp components to send request to server page or handler
and get updated info. (AJAX is just such a technology which provide
non-refresh communication between client and server in web application).
#Client Script in ASP.NET Web Pages
http://msdn2.microsoft.com/en-us/library/3hc29e2a.aspx

#setTimeout or setInterval
http://javascript.about.com/library/blstvsi.htm

http://www.evolt.org/article/Using_s...cript_Listener
/17/36035/

Hope this helps.

Regards,

Steven Cheng
Microsoft Online Community Support
==================================================

When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.

==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

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

Jun 6 '06 #6
Hello Ryan,

How are you doing on this issue? Does my further reply helps a little?
Please feel free to post here if there is still anything we can help you.

Regards,

Steven Cheng
Microsoft Online Community Support
==================================================

When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.

==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

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

Jun 8 '06 #7
Hi Steven,

Actually this project has gotten pushed back as another more pressing
project has come in for me to work on so I haven't had a chance to try this
out yet. Thanks for the links though which I have saved and I will
certainly look them over closer when I can get back to this.

Ryan
"Steven Cheng[MSFT]" <st*****@online.microsoft.com> wrote in message
news:Vp**************@TK2MSFTNGXA01.phx.gbl...
Hello Ryan,

How are you doing on this issue? Does my further reply helps a little?
Please feel free to post here if there is still anything we can help you.

Regards,

Steven Cheng
Microsoft Online Community Support
==================================================

When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.

==================================================
This posting is provided "AS IS" with no warranties, and confers no
rights.

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

Jun 8 '06 #8
Sure Ryan,

Please feel free to post here when you meet further problem on this issue
later or let me know if you got any progress.

Good luck!

Regards,

Steven Cheng
Microsoft Online Community Support
==================================================

When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.

==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

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

Jun 9 '06 #9
Steven,
var img = document.getElementById("imgTitle");
img.src = "new image url";
I thought as well on that solution, problem with is, that you have to know
the name of the image (it cannot have the same name because than it will get
it again from cache). You don't know that name, therefore you see in my
sample that removing from cache from the page where the image is in. (At
least I cannot remove a single image from cache in using a webpage).

:-)

Cor

If you want to get some certain status info from server-side, you can
consider use xmlhttp components to send request to server page or handler
and get updated info. (AJAX is just such a technology which provide
non-refresh communication between client and server in web application).
#Client Script in ASP.NET Web Pages
http://msdn2.microsoft.com/en-us/library/3hc29e2a.aspx

#setTimeout or setInterval
http://javascript.about.com/library/blstvsi.htm

http://www.evolt.org/article/Using_s...cript_Listener
/17/36035/

Hope this helps.

Regards,

Steven Cheng
Microsoft Online Community Support
==================================================

When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.

==================================================
This posting is provided "AS IS" with no warranties, and confers no
rights.

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

Jun 9 '06 #10
Ryan,

Special for you made my fellow Ken this Tip.

http://www.vb-tips.com/dbPages.aspx?...3-d62c0c562ffe

I hope this helps,

Cor

"Ryan" <Ty****@newsgroups.nospam> schreef in bericht
news:%2****************@TK2MSFTNGP03.phx.gbl...
Hi Steven,

Actually this project has gotten pushed back as another more pressing
project has come in for me to work on so I haven't had a chance to try
this out yet. Thanks for the links though which I have saved and I will
certainly look them over closer when I can get back to this.

Ryan
"Steven Cheng[MSFT]" <st*****@online.microsoft.com> wrote in message
news:Vp**************@TK2MSFTNGXA01.phx.gbl...
Hello Ryan,

How are you doing on this issue? Does my further reply helps a little?
Please feel free to post here if there is still anything we can help you.

Regards,

Steven Cheng
Microsoft Online Community Support
==================================================

When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.

==================================================
This posting is provided "AS IS" with no warranties, and confers no
rights.

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


Jun 9 '06 #11

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

Similar topics

8
by: Jim Hammond | last post by:
The following code tries to excute a function 10 seconds after Page_Load by using a Timer, but the callback never gets called. private void Page_Load(object sender, System.EventArgs e) { ...
4
by: Abu Haider | last post by:
I need a method to be called every 10 Seconds in an ASP.NET web application, and I was wondering the best way of doing it. I created a static Method on a Page and passed it to a Server Timer that is...
6
by: Antti Laakso | last post by:
Hi i have function like above Public Sub halytystutkinta() Dim ds As New DataSet ds = dl2.HaeHalytys() Dim onkohal As Int16 onkohal = ds.Tables(0).Rows(0).Item("onkohalytys") halid =...
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: ...
6
by: Xero | last post by:
Hi. I have created a 'stop watch' program. The working principle of the program is to declare an integer (say 'intTime'), which is initalized to zero. Once the user clicks the 'Start' button,...
4
by: Lemune | last post by:
Hello everyone. I'm using vb 2005. I'm creating program that run as service on windows. And in my program I need to use timer, so I'm using timer object from component. I try my source code on...
1
by: Michael Lang | last post by:
I have a class deriving from System.ComponentModel.Component. In VS 2003 I could drag it on to a web form. However I'm finding in VS 2005 whilst it functions perfectly at runtime. At design...
10
by: Phil | last post by:
I'm glad to see that in VB 2005 I no longer have to create a form if I want a timer like I did in VB6. I notice though, that there seems to be a Timer component as well as two different timer...
3
by: Steve | last post by:
Hi All I am using VB.net 2008 and use timer controls within my applications Question Does the code in a Timer control.tick event run on a different thread to the main Application thread (UI...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.