HI,

I am new to asp.net.

I have 365 pages and i want to display each of those on 365 days

say I have a page to be displayed on sept 19..

on clicking the Enter site it should validate which day and should navigate to that particular page.

looking forward for all your support

Gautam

Recommended Answers

All 2 Replies

HI my friend...

assuming that you have 365 pages already made, you could do the following

- THIS IS A QUICK FIX

What you need is a table in your database with 3 columns

1. PrimaryKey INT, NOT NULL
2. Date DATETIME
3. NavigateURL VARCHAR(MAX)

In your database you will have a page per day linked to the date.

You can use this script

CREATE PROCEDURE TEMP_Procedure
AS
BEGIN
DECLARE @Start INT
DECLARE @END INT

SET @Start = 0
SET @End = 356

Secondly you need to add the dates
DECLARE @StartDate DATETIME 
SET @StartDate = (The date you want to start on)

WHILE @Start <= @End
BEGIN
INSERT INTO dbo.YourTableName
(
    PrimaryKey
,   Date 
)
VALUES
(
    @Start
,   @StartDate
)
@Start = @Start + 1
@StartDate = DATEADD(@StartDate , DAY, 1) -- Play with the sequence as i am a bit unsure of the sequence
END

This will give you the Identities per page
as well as the dates
...

now all you need to do is specify the page.

--------------------------------------------------------

No in your code you can fill a dataset with the URL

Your query will look like this

string.Format("SELECT NavigateURL FROM Table WHERE Date = '{0}'", DATETIME.NOW.DATE);

and then you will redirect

Response.Redirect(DataSetName.Tables[0].Rows[0][0/*this is the column*/].ToString());

There you go mate , have a good one...

commented: good answer +15

After you login just call a redirect based on the day of year:

string url = string.Format("/page_{0:F0}.aspx", DateTime.Today.DayOfYear);
      Response.Redirect(url);

You could also use the method cVz posted if you are using a database.

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.