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

Hide EndDate DateTimePicker

4 Answers 87 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Chris
Top achievements
Rank 1
Chris asked on 09 Mar 2015, 09:56 PM
Hi
I have a scheduler using the advanced template for edit & insert.
The End Date is set programmatically.
I want to hide the End Date input entirely (date picker, time picker and label) on both the edit and insert forms.
I am using this method to hide the all day checkbox and I can also hide the End Date picker using this method but the time picker and the End date label still appears on the Edit form.
I want to hide all controls for End Date Input on both Edit & Insert forms.
Thanks in advance
Chris

Protected Sub RadScheduler1_FormCreated(sender As Object, e As Telerik.Web.UI.SchedulerFormCreatedEventArgs)
    If (e.Container.Mode = SchedulerFormMode.AdvancedEdit) OrElse (e.Container.Mode = SchedulerFormMode.AdvancedInsert) Then
        Dim allDayCheckBox As CheckBox = DirectCast(e.Container.FindControl("AllDayEvent"), CheckBox)
        allDayCheckBox.CssClass = "Hide"
         
        Dim endDate As RadDatePicker = DirectCast(e.Container.FindControl("EndDate"), RadDatePicker)
        endDate.CssClass = "Hide"
 
        Dim startDate As RadDatePicker = TryCast(e.Container.FindControl("StartDate"), RadDatePicker)
        startDate.ClientEvents.OnDateSelected = "changeEndDate"
         
    End If
End Su

4 Answers, 1 is accepted

Sort by
0
Ivan Danchev
Telerik team
answered on 12 Mar 2015, 01:57 PM
Hello,

Your code is valid and should work if you are overriding the default CSS styles. I tested your code by adding аn "!important" declaration:
.Hide {
    display: none !important;
}
and "EndDate" and "All Day" check box were not displayed.

Another way to achieve the same effect is to set the Visible properties to false in the code-behind, without adding a CssClass:
protected void RadScheduler1_FormCreated(object sender, SchedulerFormCreatedEventArgs e)
{
    if (e.Container.Mode == SchedulerFormMode.AdvancedEdit || e.Container.Mode == SchedulerFormMode.AdvancedInsert)
    {
        RadDatePicker endDate = (RadDatePicker)e.Container.FindControl("EndDate");
        endDate.Visible = false;
 
        CheckBox allDayCheckBox = (CheckBox)e.Container.FindControl("AllDayEvent");
        allDayCheckBox.Visible = false;
    }
}


Regards,
Ivan Danchev
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Chris
Top achievements
Rank 1
answered on 12 Mar 2015, 08:54 PM
Thank you Ivan.
The problem is that the End time Label is still visible with both methods.
How do I reference the End time label?
I've tried to hide the whole input by using "endTimeInput as RadDateTimePicker" but doesn't work.
Also tried "endTimeLabel as Label" doesn't work either.
Any thoughts?
Regards
Chris

0
Chris
Top achievements
Rank 1
answered on 13 Mar 2015, 12:58 AM
I've fixed this with a rough workaround
$('.rsEndTimePick > label').text("");
0
Ivan Danchev
Telerik team
answered on 17 Mar 2015, 12:22 PM
Hello,

I am glad you found a solution. Another way to hide the EndTime label, apart from doing it with jQuery, is with CSS:
html .RadScheduler .rsEndTimePick .rfbLabel {
    display: none;
}

Regards,
Ivan Danchev
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Scheduler
Asked by
Chris
Top achievements
Rank 1
Answers by
Ivan Danchev
Telerik team
Chris
Top achievements
Rank 1
Share this question
or