Click here to Skip to main content
15,920,030 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
iwant display weekview from monday to sunday it should repeat between starting and ending dates..please help me out...Thanks in advance
it should like
monday 4/11/2013(starting day of the week)
tuesady5/11/2013
'
'
'
'
Sunaday10/11/2103
monday11/11/2013
tuesday12/11/2013
'
'
'
'
sunday17/11/2013(ending day of the week)
Posted
Updated 18-Nov-13 19:51pm
v2
Comments
What have you tried?

1 solution

Try this code.

XML
List<DateTime> BuildWeeks(DateTime start,DateTime end)
       {
           List<DateTime> dates = new List<DateTime>();
           DateTime weekStart, weekEnd;
           weekStart = start.AddDays(0-start.DayOfWeek);
           weekEnd = end.AddDays((double)(7 - end.DayOfWeek));
           for (int x = 1; x < (weekEnd - weekStart).Days+1;x++)
           {
               dates.Add(weekStart.AddDays(x));
           }
           return dates;
        }
 
Share this answer
 
v2
Comments
raki528 19-Nov-13 2:39am    
Hi arjun thanks for help....but my requirement is iwant display monday to sunday in one div
another week should display in another div and so on.....its just calendar...but iwant show only week view....
ArunRajendra 19-Nov-13 3:00am    
Its quite simple. Now I have modified my solution to store from Monday to Sunday. Just start from first date loop till 7 and write to div. Repeat this for all the weeks. Good luck
raki528 19-Nov-13 8:20am    
Thanks for the help....
ArunRajendra 19-Nov-13 9:59am    
Mark the solution as answered if it has helped in solving your issue.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900