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

AdvancedEditTemplate - Format Date / Time

2 Answers 43 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Allan
Top achievements
Rank 1
Allan asked on 28 Aug 2012, 11:29 PM
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 Answers, 1 is accepted

Sort by
0
Kalina
Telerik team
answered on 29 Aug 2012, 11:19 AM
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.
0
Allan
Top achievements
Rank 1
answered on 29 Aug 2012, 12:17 PM
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

Tags
Scheduler
Asked by
Allan
Top achievements
Rank 1
Answers by
Kalina
Telerik team
Allan
Top achievements
Rank 1
Share this question
or