Monthly Repeater for news articles

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
 
R

Ray Costanzo

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
 
S

sloan

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,050
Latest member
AngelS122

Latest Threads

Top