I am using WebDateChooser Infragistics 7.1 on ASP.Net2.0 using c#. I want the webdatechooser to show todays date selected by default on the calendar when I open the calendar. Also if I change the month the same date as selected should be chosen on the selected month. For example, if I chose 10/13/2008 on the calendar, after that I change over to next month, so by default the date selected should be 11/13/2008 and so on.
Can you please help me acheive both these objectives.
Thanks,
Shalini.
Hi Shalini,
To select today in calendar when no date in date chooser, you may process AfterDropDown. To change selected date in calendar you may process CalendarMonthChanged. Below is an example.
<script type="text/javascript">function dc1_AfterDropDown(oDateChooser, dropDownPanel, oEvent){ if(!oDateChooser.getValue()) oDateChooser.Calendar.setSelectedDate(new Date());}function dc1_CalendarMonthChanged(oCalendar, oDate, oEvent){ var visDate = oCalendar.getVisibleMonth(); var date = oCalendar.getSelectedDate(); if(!date) date = new Date(); oCalendar.setSelectedDate(new Date(visDate.getFullYear(), visDate.getMonth(), date.getDate()));}</script>
<igsch:WebDateChooser ID="dc1" runat="server"> <ClientSideEvents AfterDropDown="dc1_AfterDropDown" CalendarMonthChanged="dc1_CalendarMonthChanged"></ClientSideEvents></igsch:WebDateChooser>