Binding recurrence rule from client side

2 posts, 0 answers
  1. Mahesh
    Mahesh avatar
    12 posts
    Member since:
    Jul 2012

    Posted 19 Sep 2012 Link to this post


      we are trying to bind the recurrence rule from javascript.

    Upon saving , we are taking the recurrence rule from javascript and saving it to database. On taking the recurrence rule it is shown as "DTSTART:20120927T000000Z  DTEND:20120927T000000Z  RRULE:FREQ=WEEKLY;UNTIL=20120928T000000Z;INTERVAL=1;BYDAY=WE,SU;WKST=".
    We are saving this value in db.

    After that on the client form created we are taking the appointment details corresponding to this appointment id using one service call and we are getting the values in javascript.

    After that we are trying to bind this value to controls.

    So for binding recurrence rule we are using the below given code.

    var rrule = Telerik.Web.UI.RecurrenceRule.parse(apt1.get_recurrenceRule());    
    var editor = $find("<%=AppointmentRecurrenceEditor.ClientID%>");
     Here recurrence is not binding when we alerted the value of "rrule" it is shown as "null"

    After that we tried like setting the rule as such in set method like

    var editor = $find("<%=AppointmentRecurrenceEditor.ClientID%>");
    editor.set_recurrenceRule("DTSTART:20120927T000000Z  DTEND:20120927T000000Z  RRULE:FREQ=WEEKLY;UNTIL=20120928T000000Z;INTERVAL=1;BYDAY=WE,SU;WKST=");

    In this case we are getting an error like "TypeError: i.get_pattern is not a function".

    Please advice us on how to proceed in this case..


  2. Boyan Dimitrov
    Boyan Dimitrov avatar
    2062 posts

    Posted 24 Sep 2012 Link to this post

    Hello Mahesh,

    The problem that you have with your first approach is
    • Accessing a recurrence rule from appointment object is possible only when web services used.
    • Here you can find more information about client side appointment object and its methods.
    In case of using a string object to represent a recurrence rule I will suggest to use "\n" symbol instead of " "
    space(empty string). Example below shows recommended syntax for recurrence rule that will be parsed without any errors:
    //aspx file

    <telerik:RadScheduler runat="server" ID="RadScheduler1"


    function OnClientFormCreated(sender, eventArgs) {
                var $ = $telerik.$;
                var mode = eventArgs.get_mode();
                if (mode == Telerik.Web.UI.SchedulerFormMode.AdvancedInsert ||
                        mode == Telerik.Web.UI.SchedulerFormMode.AdvancedEdit) {
                    var editorjQueryObject = $("[id$='RecurrenceEditor']");
                    var editor = $find(editorjQueryObject.attr("id"));
                    var stringRule = "DTSTART:20120927T000000Z\nDTEND:20120927T000000Z\nRRULE:FREQ=WEEKLY;UNTIL=20120928T000000Z;INTERVAL=2;BYDAY=WE,SU;";
                    var rrule = Telerik.Web.UI.RecurrenceRule.parse(stringRule);

    I hope this was helpful.

    Boyan Dimitrov
    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.
Back to Top