Set Appointment Description in Javascript

3 posts, 0 answers
  1. Stephen
    Stephen avatar
    1 posts
    Member since:
    Jul 2008

    Posted 16 Feb 2011 Link to this post

    All,

    Can you please inform me how I can populate the appointment description field thru Javascript.

    I have everything working for all other fields except description.  When i double click on the appointment , the advance form does display the description field but it is empty.
    I am writing the appointments to am XML file, I see entries for <description></description> , once again blank.

    Any advise would be helpful.
    function rowDropping(sender, args) {
           // Fired when the user drops a grid row
           var htmlElement = args.get_htmlElement();
           var scheduler = $find('<%= RadScheduler1.ClientID %>');
           var tree = $find('<%= RadTreeView1.ClientID %>');
           var login = $find('<%= LoginName1.ClientID %>');
           var node = tree.get_selectedNode();
           var treenode = tree.get_selectedNode();
           //alert(treenode.get_attributes().getAttribute("Park"));
           var park = treenode.get_attributes().getAttribute("Park");
           if (isPartOfSchedulerAppointmentArea(htmlElement)) {
               // The row was dropped over the scheduler appointment area
               // Find the exact time slot and save its unique index in the hidden field
               var timeSlot = scheduler._activeModel.getTimeSlotFromDomElement(htmlElement);
               //args.get_htmlElement("TargetSlotHiddenField").value = timeSlot.get_index();
               // The HTML needs to be set in order for the postback to execute normally
               //args.set_htmlElement("TargetSlotHiddenField");
               var newAppointment = new Telerik.Web.UI.SchedulerAppointment(); 
               var startTime = timeSlot.get_startTime();
               var endTime = new Date(startTime);
               endTime.setMinutes(endTime.getMinutes() + 30);
               var subject = node.get_text();                    
               newAppointment.set_start(startTime); // This populates
               newAppointment.set_end(endTime); // This populates
               newAppointment.set_subject(subject); // This  populates
               newAppointment.set_description("hello"); // Does not  populate
               newAppointment.set_borderColor("Green"); // Does not change
               newAppointment.set_backColor("DarkGreen");  // Does not  change
               scheduler.insertAppointment(newAppointment);
     
           }
  2. Eric
    Eric avatar
    4 posts
    Member since:
    Jan 2013

    Posted 17 Dec 2013 Link to this post

    SAME PROBLEM !
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Hristo Valyavicharski
    Admin
    Hristo Valyavicharski avatar
    975 posts

    Posted 20 Dec 2013 Link to this post

    Hi,

    You could set description in the OnClientFormCreated event: 
    function OnClientFormCreated(sender, args) {
        var mode = args.get_mode();
        if (mode == Telerik.Web.UI.SchedulerFormMode.AdvancedInsert ||
            mode == Telerik.Web.UI.SchedulerFormMode.AdvancedEdit) {
            var descriptionJQueryObject = $telerik.$("[id$='Form_Description']");
            var descriptionRadTextBoxObject = $find(descriptionJQueryObject.attr("id"));
            descriptionRadTextBoxObject.set_value("Add more details about the appointment here.");
        }
    }

    Sample is attached.

    Regards,
    Hristo Valyavicharski
    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.
Back to Top