views:

13

answers:

1

Hi,

say i have 2 asp.net default calendars. Now from one i select the date as August 20 2010 and in second i select the date as March 2011.

My Question: How can i generate dynamic calendars based on dates that i have selected inclusive of the dates? Hence for above example the dynamic calendars would be say from August 2010, September 2010, Oct 2010, Nov 2010.....Upto March 2011.

I want this to happen in ASP.NET ONLY.(ver 2.0/3.5)

Please help

Thanks!

+1  A: 

Hey,

You could use the Calendar control, and add them to the page dynamically in the init event, simply by adding the Calendar control to the page, while setting the VisibleDate property to ensure the correct month appears. Any fine-tuning of the dates can happen by attaching to the DayRender event.

HTH.

Brian
Thanks for the suggestion, but could you please show how Day Render event would work?Plus how would i be able to know that how many calendars are to be added in Init Event of the page?
Romil Nagrani
It's the months between the two dates, correct? You have to do a subtraction of months to find that out, then store that in viewstate so you can recreate the calendars on page load. DayRender fires for each day in the calendar; if you need to enable/disable certain days, then you can do this through the event args in the DayRender event. See: http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.calendar.dayrender.aspx
Brian