AdvancedEditTemplate - Format Date / Time

3 posts, 0 answers
  1. Allan
    Allan avatar
    3 posts
    Member since:
    Aug 2012

    Posted 28 Aug 2012 Link to this post

    Hello,

    I'm trying to format the DataStartField and DataEndField in a AdvanceEditTemplate in such a way that I'm separating the Date and Time to display on 2 separate lines.

    From the example CustomizeAdvFormVariousDS-VB.zip I'm using the <%# Bind("Start") %> and that results in the full date/time.  I saw that I could use Start.Date and Start.TimeOfDay.  But Start.Date still showed the full date/time.

    I'm so close to finishing ... please help!
  2. Kalina
    Admin
    Kalina avatar
    918 posts

    Posted 29 Aug 2012 Link to this post

    Hello Allan,

    As far as I understand - you want to separate the Date and Time on two lines in the StartTime and EndTime datepickers in AdvancedForm.
    I am afraid that this is not a supported scenario.
    You can optionally try to display the Date and Time in separate controls - as is demonstrated here.

    Regards,
    Kalina
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  3. Allan
    Allan avatar
    3 posts
    Member since:
    Aug 2012

    Posted 29 Aug 2012 Link to this post

    Hello,

    Sorry I wasn't very clear... Basically I'm converting the AdvancedEditTemplate Form into a read-only modal.  That was accomplished by removing the save button, and renaming the cancel to close.  

    I've added the following javascript and appropriate event handlers to the radscheduler - cancel dragging / moving update and 1-click open.

    (Please excuse my short hand code mark up)
    aspx form declaration:
    <telerik:RadScheduler ...
     
    onClientAppointmentClick="RadScheduler1_AppointmentClick"
    OnClientAppointmentMoving="OnClientAppointmentMovingHandler"  
    OnClientAppointmentResizing="OnClientAppointmentResizingHandler"
     
    Javcascript:
         function OnClientAppointmentMovingHandler(sender, eventArgs) 
        
            eventArgs.set_cancel(true); 
        }     
        function OnClientAppointmentResizingHandler(sender, eventArgs) 
        
            eventArgs.set_cancel(true); 
        }
     
        function RadScheduler1_AppointmentClick(sender, eventArgs)
        {
            var apt = eventArgs.get_appointment();              
          sender.editAppointmentWithConfirmation(apt);
        }


    The solution I needed was:
    <asp:Label ID="StartTime" runat="server" Text='<%# Eval("Start").ToShortDateString %>'></asp:Label>

    Also for a more complete answer...
    In the function  RadScheduler1_FormCreated I could do something as follows to modify the AdvancedEditTemplate
    which I have declared <asp:Label ID="lblStart" runat="server" text ='' /> 

    Dim startDate as label
    startDate = e.Container.FindControl("lblStart")
    startDate.Text = e.Appointment.Start.ToShortDateString

     
    Regards,
    allan

Back to Top