This is a migrated thread and some comments may be shown as answers.
Select current month
1 Answer 20 Views
This is a migrated thread and some comments may be shown as answers.
Smiely
Top achievements
Rank 1
Smiely asked on 05 Jan 2011, 04:11 PM
I am using RadDateTimePicker. I have set a mindate and maxdate. Also it shows todays date. When I open the calender it shows the month of mindate. How do I get it to open current month. In .cs file,

((

RadDateTimePicker)this.FindControl("FromDatePicker")).SelectedDate = DateTime.Now;

 

 Is not working.

<telerik:GridBoundColumn DataField="DateCreated" HeaderText="Date Created"  
            UniqueName="DateCreated" FilterListOptions="VaryByDataTypeAllowCustom">
            <FilterTemplate>
                        From
                        <telerik:RadDateTimePicker ID="FromDatePicker" runat="server" Width="185px" Skin="WebBlue" DateInput-EmptyMessage="MinDate"
                            MinDate="01-01-2010" MaxDate="12-31-2011"  DbSelectedDate='<%# startDate1 %>'>
                            <TimeView ID="TimeView1" OnClientTimeSelected="DateSelected" runat="server">
                            </TimeView>
                             <ClientEvents OnDateSelected="DateSelected1" OnPopupOpening="PopupOpening" />
                             <Calendar runat="server"
                             <SpecialDays> <telerik:RadCalendarDay Repeatable ="Today" ItemStyle-BackColor="Red"
                             </telerik:RadCalendarDay></SpecialDays>
                             </Calendar>
                        </telerik:RadDateTimePicker>
                        to
                        <telerik:RadDateTimePicker ID="ToDatePicker" runat="server" Width="185px" MinDate="01-01-2010" Skin="WebBlue" DateInput-EmptyMessage="MinDate"
                            MaxDate="12-31-2011"  DbSelectedDate='<%# endDate1 %>'>
                            <TimeView ID="TimeView2" OnClientTimeSelected="DateSelected" runat="server" >
                            </TimeView>
                             <ClientEvents OnDateSelected="DateSelected1"  OnPopupOpening="PopupOpening" />
                             <Calendar ID="Calendar1" runat="server">
                             <SpecialDays> <telerik:RadCalendarDay Repeatable ="Today" ItemStyle-BackColor="Red">   
                             </telerik:RadCalendarDay></SpecialDays>
                             </Calendar>
                        </telerik:RadDateTimePicker>
                        <telerik:RadScriptBlock ID="RadScriptBlock111" runat="server">
  
                            <script type="text/javascript">
                                function DateSelected(sender, args) {
                                    var tableView = $find("<%# ((GridItem)Container).OwnerTableView.ClientID %>");
                                    tableView.filter("DateCreated", "", "Between");
                                }
                                var isDateToBeSet = true;
                                function DateSelected1(sender, args) {
                                    if (isDateToBeSet) {
                                        sender.get_timeView().setTime(00, 01, 0, null);
                                    }
                                }
                                function PopupOpening(sender, args) {
                                    isDateToBeSet = args.get_popupControl().get_id().indexOf("timeView") != -1 ? false : true;
  
                                }
                            </script> </telerik:RadScriptBlock>
                    </FilterTemplate>
            <HeaderStyle Font-Bold="True" />
            <ItemStyle Width="31%" />
        </telerik:GridBoundColumn>
Please help.

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 1
answered on 06 Jan 2011, 06:23 AM
Hi Smiley,


Set the FocusedDate property (specifies the date that has focus) of the RadDateTimePicker to determne which month to be shown in the calendar, by default.
Managing Dates


-Shinu.
Asked by
Smiely
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 1
Share this question
or