DividesByZero
DividesByZero

Reputation: 83

How to create only a week calendar with previous and next week buttons

I am really stucked at this.what i want is that there should be 6 table cells in which i should have days with date. like Monday 4/3/2013 Tuesday 5/3/2013 and so on till saturday .i have two more buttons,previous week and next week button.. it should automatically show next week when i click the next week button and should show the previous week whenever i press the previous button.. also the i need to take the value of days/month and year so that i can use them in where clause in my sql query..pls its urgent can anyone help me with this...

im providing a link you can see what exactly i want by visiting this link

www.test.ginormous.in/dinesmart/Filestore/Food/Capture.png

Upvotes: 1

Views: 1666

Answers (1)

Saksham
Saksham

Reputation: 9380

i am just giving you the outline as posting the whole code is not possible.

  1. create an asp:panel in your aspx page
  2. try generating the table structure dynamically inside that panel by writing myPanel.innerhtml = "(your html structure generated in a string)"
  3. use theDate.AddDays(7 - (int)theDate.DayOfWeek) to get the date for this weeks sunday.(where theDay is the current date or the date given by you and change 7 to 6 if you want it for monday as this returns date for sunday etc..)
  4. on previous and next click you can add or subtract 7 days from the first day of the weel that is generated above.

hope this helps you.

Upvotes: 1

Related Questions