Hide EndDate DateTimePicker

5 posts, 0 answers
  1. Chris
    Chris avatar
    4 posts
    Member since:
    Dec 2012

    Posted 09 Mar 2015 Link to this post

    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
  2. Ivan Danchev
    Admin
    Ivan Danchev avatar
    829 posts

    Posted 12 Mar 2015 Link to this post

    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.

     
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Chris
    Chris avatar
    4 posts
    Member since:
    Dec 2012

    Posted 12 Mar 2015 in reply to Ivan Danchev Link to this post

    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

  5. Chris
    Chris avatar
    4 posts
    Member since:
    Dec 2012

    Posted 12 Mar 2015 in reply to Chris Link to this post

    I've fixed this with a rough workaround
    $('.rsEndTimePick > label').text("");
  6. Ivan Danchev
    Admin
    Ivan Danchev avatar
    829 posts

    Posted 17 Mar 2015 Link to this post

    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.

     
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017