This is a migrated thread and some comments may be shown as answers.

How to set todays date to radDateTime Picker like ajax calender extender

2 Answers 213 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
Venkat
Top achievements
Rank 1
Venkat asked on 27 Jun 2012, 11:37 AM
Hi i am using raddatetimepicker verson=2011.1.519.35 in asp.net i want to set todays date to it...
it is possible with ajaxcalender extender like
function clientShowing(sender, args) {
            if (new Date($get("HiddenField1").value) != null) {
                sender.set_todaysDate(new Date($get("HiddenField1").value));
            }
        }
<form id="form1" runat="server">
    <div>
        <asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
        </asp:ToolkitScriptManager>
        <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
        <asp:calendarextender ID="CalendarExtender1" runat="server" Enabled="True" Format="dd/MM/yyyy"
            TargetControlID="TextBox1" OnClientShowing="clientShowing"
            PopupPosition="BottomLeft">
        </asp:calendarextender>
        <asp:HiddenField ID="HiddenField1" runat="server" />
         
    </div>
    </form>

it means whatever date in hiddenfield, i want to set it to raddatetimepicker as today date...
how to do it for asp.net...

2 Answers, 1 is accepted

Sort by
0
Kevin
Top achievements
Rank 2
answered on 27 Jun 2012, 12:35 PM
Hello Venkat,

I'm assuming you're asking how to default the RadDateTimePicker to today's date. If so, this is how you would do it:

Code-Behind:
RadDateTimePicker.SelectedDate = DateTime.Today

Or in javascript, you can handle the OnClientLoad event of the RadDateTimePicker:
function OnClientLoad(sender, args) {
    sender.set_selectedDate(new Date());
}

If you're asking how to highlight today's date in the date picker popup. It would look like so:

ASPX:
<telerik:RadDateTimePicker ID="RadDateTimePicker1" runat="server">
    <Calendar>
        <SpecialDays>
            <telerik:RadCalendarDay Repeatable="Today" Date="" ItemStyle-CssClass="rcToday" />
        </SpecialDays>
    </Calendar>
</telerik:RadDatePicker>

I hope that helps.
0
Venkat
Top achievements
Rank 1
answered on 27 Jun 2012, 12:55 PM
Hi Kevin...
I am using raddatetimepicker and my server is in One timezone like "India Standard Time" k...
i need this raddatetimepicker to show its today date as server timezone or specific timezone not client timezone...
some one said timezone setting is not possible for raddatetimepicker in asp.net...
for ajax calender extender i am assigning today's date by finding based on specific timezone ,so it is always hilighting server time only..
one more is when ever client side function sets selected date it is populating in textbox also i don't need that..
when user select only it will populate....
plz see this and give me suggition...
Tags
Calendar
Asked by
Venkat
Top achievements
Rank 1
Answers by
Kevin
Top achievements
Rank 2
Venkat
Top achievements
Rank 1
Share this question
or