Hi All,

I've been away from daniweb for a long time but now need some help!

I have created a number of 'reports' for my customer, these are separate pages with controls to allow parameters to be set and a gridview to list records.

I now need to find a way to automatically cycle through a set of these pages.
The idea is that my customer wants to have these on display in their flashy new HQ.

I've started researching this and seen examples of using the Timer control to have a page perform a postback after a set period of time... this may be the way to do it but I'm not sure.
The obvious problem here is that I would want to keep all the page cycling logic in one page, and I also don't want to alter the existing 'report' pages.

I was thinking about a page that performs auto postback and has embedded into it one of the report pages.
That way the cycling logic (how often to cycle, which report to show next etc) would be in one page and would bring in whichever report page was needed next... writing this now it starts to sound like this could be done with a Master page?

Has anyone got any experience of doing something like this or can advise me on a possible solution.

I use VS 2010 and the website currently targets .Net 2 (although obviously I could change this to a never version if necessary.
Looking forward to taking part in the community again...

David

Member Avatar for LastMitch

I was thinking about a page that performs auto postback and has embedded into it one of the report pages.

@David Mac

I think you just answer your own question.

If the solution is to use Master pages or the Timer Control then I have failed to find a way to do so... Is there really no-one out there with any experience of doing something like this?!

Try to copy the below tag in the head section of your masterpage.

This goes near the top of your head section.

<meta http-equiv="refresh" content="3";url="http://www.xyz.com/default.aspx">

the numerical value is the number of seconds before refeshing. This WILL refresh after 3 seconds, no matter what, with no control over this due to user interaction, etc.
Change to 0 for immediate or any higher value for a longer pause.

The url value is the url to which it is sent... this can be a redirect or reload.
To make it just reload, just remove the second part, so you only have:
content="3", without the ;url=... part.

Remember that this will just affect the current page, so if you create a loop to the same page, the refreshing will continue forever, each X seconds. But if you link to another page, it will just stop after going there, unless, of course, that page also has a refresh on it.

http://www.hscripts.com/tutorials/html/autorefresh.php

Thanks for the idea but as you yourself point out, if I refresh to a different page (which obviously I have to in order to cycle between pages), then this will only allow one change!
I need a more sophistacated solution that allows control of the each change

I have to in order to cycle between pages), then this will only allow one change!

So can you clarify something.... you have to refresh the current page, or just go from page to page?

For example.. user sees:

Page 1 --> x seconds redirects to --> Page 2 --> x seconds redirects to --> Page n, etc..

is this what you mean? If so, you can use the <meta> element, or just plain javascript to perform the redirection after x seconds.

Yes that's exactly what I want... a constant cycle of pages through a defined loop (that the customer can customise).
The idea with this is that the customer wants to have this showing in their new HQ as a constant loop.
The problem with redirection is how do I control the loop?
I could hard code page 1 to always go to page 2 etc but that's not very flexible.
Also, the pages that need to be shown are also used elsewhere in the system as reports that the user can select from a menu. I want the solution to leave the pages unchanged (as much as possible) so that they can still function as stand-alone pages.

Hope this makes sense... I'm stumped at the moment for a solution although it seems as if such a thing should be possible!

Can you pass a value in a querystring so that you can keep the flexibility and reuse pages?

What I'm thinking is that you pass a param in the URL. For example... www.domain.com/page1.aspx?go=2

Then you read the query string on page load, assign this value to a hidden element. Once the page renders in the user's browser, the javascript code you already have in your pages looks for the hidden input element. If it has a value, redirect to that page using the appropriate URL including a param query after x seconds.

This solution requires minimal change and no values are hard coded.

You say no values are hard coded but the query string itself is hard coded!
This also requires me to put the redirection code into every report page that may be requird.

Thanks for the suggestion but this doesn't seem like the right way to do it.

What I was trying to help you come up with was a method where you would not have to have URLs coded statically in your application code. These values that you can pass between pages can be stored in a database table

With regard to the redirection, I don't see how this will be done without having code in your pages. The app needs something to be able to know that it has to redirect. This redirection code could be stored in a database as well but you would need code to query the database so no matter what you need some type of code.

In any case, I hope you find a solution.

I was hoping for a solution that would have a cycling interface (which page next, length of delay etc... ability to override next scheduled page?) followed by the actual page, all in one place.
I thought a Master page might be able to do this but thats not what it's for and I can't see a way to make that work.
Using redirection seems to complicate matters as it means there is no overall control of the flow of pages.

I'm not trying to avoid using code, I just don't want to have to put code in every page that might be the target of cycling.

I think I'm going to have to tell my customer this can't be done in the way he was hoping for... if I find a solution I'll post it here...

Thanks for your help.

Another option that comes to mind after rereading this thread and your last post is to have a single page that contains either an iframe or other element that you can control the content of that element.

So, what i'm thinking here is you have a page with say a navigation menu that contains your prev-next button, and text related to the current page, and upcoming pages, etc...

then maybe an iframe under that. Use javascript/jQuery to load the content in the iframe element and use a timer to cycle through the pages?

is that something more inline with what you are thinking about? Sort of a slideshow type of concept? take a look at this other daniweb thread. Its a slideshow that loads and cycles through web pages and has a simple menu box to control the cycle.

http://www.daniweb.com/web-development/javascript-dhtml-ajax/code/216730/siteshow-create-a-slideshow-of-web-pages

Forget the master page in asp.net, that's not what its used for.

commented: Great suggestion! +1

This sounds promising, thanks for the link... it's late here now but I will check this out in the morning, cheers!

Very promising!! I have used the code there to create my own slideshow including both my own aspx 'report' pages and external links to their own customer facing websites... Thanks a lot for this link, I had looked all over but never saw that! Cheers!

Glad to hear this may be of use.

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.