469,578 Members | 1,670 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,578 developers. It's quick & easy.

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 1443
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

8 posts views Thread by Jim Hammond | last post: by
4 posts views Thread by Abu Haider | last post: by
6 posts views Thread by Antti Laakso | last post: by
2 posts views Thread by John David Thornton | last post: by
1 post views Thread by Michael Lang | last post: by
10 posts views Thread by Phil | last post: by
3 posts views Thread by Steve | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.