How do I set start and end times client side?

2 posts, 0 answers
  1. Steve
    Steve avatar
    84 posts
    Member since:
    Aug 2013

    Posted 31 Dec 2013 Link to this post

    If I have the timeslots set to 7:00am - 10:00pm, I need to set the start time and end times in the advanced insert and advanced edit forms to be the same. Currently, they are 8:00am - 5:30pm. I need to do this client side. All the examples I see do this server side.
  2. Boyan Dimitrov
    Admin
    Boyan Dimitrov avatar
    1746 posts

    Posted 03 Jan 2014 Link to this post

    Hello,

    I would suggest using the RadScheduler client-side event ClientFormCreated as shown in the code snippet below:
    //markup code
    <telerik:RadScheduler ID="RadScheduler1" runat="server" OnClientFormCreated="clientFormCreated" ></telerik:RadScheduler>

    //JavaScript
    <script type="text/javascript">
        //Put your JavaScript code here.
        function clientFormCreated(sender, args) {
            var mode = args.get_mode();
            if (mode == Telerik.Web.UI.SchedulerFormMode.AdvancedInsert ||
                mode == Telerik.Web.UI.SchedulerFormMode.AdvancedEdit) {
                var startTimejQueryObject = $("[id$='Form_StartTime']");
                var startTimePicker = $find(startTimejQueryObject.attr("id"));
                //sets the start time to 1 PM
                startTimePicker.get_dateInput().set_value("07:00 AM");
     
                var endTimejQueryObject = $("[id$='Form_EndTime']");
                var endTimePicker = $find(endTimejQueryObject.attr("id"));
                //sets the end time to 4 PM
                endTimePicker.get_dateInput().set_value("10:00 AM");
            }
        }
    </script>

    Please refer to the following help articles for more information:

    Regards,
    Boyan Dimitrov
    Telerik
    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 the blog feed now.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top