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

RadTimePicker Issue

1 Answer 30 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Prasanth100
Top achievements
Rank 1
Prasanth100 asked on 20 Dec 2013, 07:08 AM
Hello Gurus,

     i am using RadTimePicker in my project, i have appointment date and appointment time.
Scenario : if i select date as today, then RadTimePicker time should be more than current time.
     For eg : if the current time is 10'O clock, the RadTimePicker time should be start with 11:00  
(Attached a screenshot)
 
 
<telerik:RadDatePicker runat="server" ID="RadDateAppointment" Width="200px" Skin="Metro" >
            <Calendar ID="Calendar5" runat="server" Skin="Metro" EnableKeyboardNavigation="true">
            </Calendar>
            <DateInput ID="D" runat="server" DisplayDateFormat="dd MMM yyyy" DateFormat="dd MMM yyyy"
                EmptyMessage="dd/mm/yyyy" >
            </DateInput>
        </telerik:RadDatePicker>
 
<telerik:RadTimePicker ID="RadTimePickerAppointment" Width="110px" Skin="Metro" runat="server">
            <DateInput ID="DateInput1" runat="server">
            </DateInput>
            <TimeView ID="TimeView1" runat="server" CellSpacing="-1">   
            </TimeView>  
     </telerik:RadTimePicker>

Thanks in Advance.

    Prasanth

     

1 Answer, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 20 Dec 2013, 10:38 AM
Hi Prasanth,

Please have a look into the following code snippet to achieve your scenario.

ASPX:
<telerik:RadDatePicker runat="server" AutoPostBack="true" ID="RadDateAppointment"
    Width="200px" OnSelectedDateChanged="RadDateAppointment_SelectedDateChanged">
    <DateInput ID="D" runat="server" DisplayDateFormat="dd MMM yyyy" DateFormat="dd MMM yyyy"
        EmptyMessage="dd/mm/yyyy">
    </DateInput>
</telerik:RadDatePicker>
<telerik:RadTimePicker ID="RadTimePickerAppointment" Width="110px" runat="server">
    <DateInput runat="server">
    </DateInput>
    <TimeView runat="server" CellSpacing="-1">
    </TimeView>
</telerik:RadTimePicker>

C#:
protected void RadDateAppointment_SelectedDateChanged(object sender, Telerik.Web.UI.Calendar.SelectedDateChangedEventArgs e)
{
    DateTime date = DateTime.Today;
    if (e.NewDate == date)
    {
        string time = DateTime.Now.ToString("HH");
        int hour = Convert.ToInt32(s);
        RadTimePickerAppointment.TimeView.StartTime = new TimeSpan(hour, 0, 0);
    }
}

Hope this will helps you.
Thanks,
Shinu.
Tags
Ajax
Asked by
Prasanth100
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or