Monthly Repeater for news articles

  • Thread starter Thread starter anthonykallay
  • Start date Start date
A

anthonykallay

Hi,

I am trying to display my news articles by month, i am aproaching this
via the use of a nested repeater so that the main rptr will display
the month abnd then using itemdatabound i can pull all articles for
that month.. What i am struggling with is the code to programatically
fill the main repeater with months automatically, any help to achieve
this would be greatly appreciated..

eg:

April 2007
news1
news2
news3
March 2007
news1
news2
news3
Feb 2007
news1
news2
news3
Jan 2007
news1
news2
news3
Dec 2006
news1
news2
news3

Cheers Anthony
 
Where are you getting your list of months? Are you just picking a date, say
January of 2006, and doing every month since then? Or do you have some data
source that has news articles, and you want to display each month for which
there is a news article?

Ray at work
 
Here's a query for you, using the Northwind database.

You can easily adjust it for news articles.


Select OrderID , OrderDate , datepart(yyyy , OrderDate) as OrderYear ,
datepart(m , OrderDate) as OrderMonth from Orders


WHERE
DATEDIFF ( yyyy , OrderDate , '1/1/1999' ) <=2

ORDER BY
datepart(yyyy , OrderDate) DESC , datepart(m , OrderDate) DESC
 
Back
Top