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

3 posts, 0 answers
  1. Venkat
    Venkat avatar
    8 posts
    Member since:
    Jun 2012

    Posted 27 Jun 2012 Link to this post

    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. Kevin
    Kevin avatar
    360 posts
    Member since:
    Jul 2012

    Posted 27 Jun 2012 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Venkat
    Venkat avatar
    8 posts
    Member since:
    Jun 2012

    Posted 27 Jun 2012 Link to this post

    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...
Back to Top