I wish to create an application that displays a message in a label assume that the messages have been stored in a string of array. The message automatically changes every after 30 seconds.

How can I do the change of the message every after seconds in ASP.Net using C# as my script?

Recommended Answers

All 6 Replies

hi
i think its quite not possible. You need to use third party control like ajax.

You can have it change, but you need to use javascript and ajax. Use the javascript to keep track of the timer. Once it hits 30 seconds, javascript can call a command against the server, or if you're using AJAXToolKit, use an updatepanel and have javascript target the update panel, which in return will target the server and update.

hi ,
this is very simple .use update panel for label and in page load you change the string to display in label(i think you can write the code.and use one timer control for which you need to set target control id as update panel.event will be page_load.and set the time intervel.
you will get with out any extra lines of code
thank you!

Thanks buddy! Can I have a sample code for this so that I could fully analyze your idea.

The thing is with "update panel" is that you have to download AJAXToolKit, and then you must enable your server to accept it, otherwise it will be problem after problem.

There is also a class called Timer that allows a function to be called at a set interval. When you add this AJAX functionality, set the Timer class to trigger it at every (30000) (30 seconds = 30,000 ms)

Thanks!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.