| | |
asp code to Rotate page based on the day
Please support our ASP.NET advertiser: Intel Parallel Studio Home
![]() |
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
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...
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
TSQL Syntax (Toggle Plain Text)
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...
Delphi & C# programmer deluxe...
After you login just call a redirect based on the day of year:
You could also use the method cVz posted if you are using a database.
ASP.NET Syntax (Toggle Plain Text)
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.
![]() |
Similar Threads
- Simple ASP.Net Login Page using C# (C#)
- Updated : Simple ASP.Net Login Page (ASP.NET)
- ASP.NET Registration Page (ASP.NET)
- asp code generated as text, needed to be seen as asp code again. databses backup (ASP)
- Simple ASP.Net Login Page (Using VB.Net) (ASP.NET)
Other Threads in the ASP.NET Forum
- Previous Thread: F5 debug mode for ASP.NET Application “Not in Debugger Group” Warning
- Next Thread: ASP.NET MVC redirect problem
| Thread Tools | Search this Thread |
2.0 advice asp asp.net beginner businesslogiclayer c# checkbox control countryselector courier dataaccesslayer database datagridview dropdownlist dropdownmenu expose fileuploader flash iframe iis javascript jquery listbox mssql redirect relationaldatabases rotatepage search sql-server tracking treeview validatedate validation vb.net video virtualdirectory vista visual-studio visualstudio webarchitecture webdevelopemnt webdevelopment webprogramming windows7 wizard xml xsl







