Change End date on resource selected index changed.

3 posts, 0 answers
  1. ISCServices
    ISCServices avatar
    3 posts
    Member since:
    Feb 2011

    Posted 26 Apr 2011 Link to this post

    Hi,

     I have added resource control which is showing fine in radschedule  advance form. I need to change end date and time according to selected value from the added resource, however unable to find selected index changed event of added resource!! Do I need to implement AdvancedForm.ascx for that or should I use “AdvancedInsertTemplate” “AdvancedEditTemplate”  with normal dropdown?

    If I implement second approach getting issue in “AdvancedInsertTemplate” and “AdvancedEditTemplate” while retrieving reoccurrence rules and parent ID…. 

  2. ISCServices
    ISCServices avatar
    3 posts
    Member since:
    Feb 2011

    Posted 27 Apr 2011 Link to this post


    well I implemented AdvancedForm.ascx however it's very slow.. Any suggestion ?
  3. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 29 Apr 2011 Link to this post

    Hello,

    Here is one possible solution:
    <script type="text/javascript"
           var endTimeHours = null
           function OnClientSelectedIndexChanged(sender, args) { 
               var endTimePickerId = document.getElementById("HiddenField1").value; 
               var endTimePicker = $find(endTimePickerId); 
               var endTime = endTimePicker.get_selectedDate();            
               var hourIncrement = 0; 
               if (endTimeHours == null
                   endTimeHours = endTime.getHours(); 
               var selectedItemText = args.get_item().get_text(); 
               if (selectedItemText == "Lesson B (2 hours)"
                   hourIncrement = 1; 
               else if (selectedItemText == "Lesson C (3 hours)"
                   hourIncrement = 2; 
               else if (selectedItemText == "Lesson D (4 hours)"
                   hourIncrement = 3; 
               endTime.setHours(endTimeHours + hourIncrement); 
               endTimePicker.set_selectedDate(endTime); 
           
             
     </script>  
       <asp:HiddenField ID="HiddenField1" runat="server" /> 
       <telerik:RadScheduler runat="server" ID="RadScheduler1" 
           onformcreated="RadScheduler1_FormCreated"
       </telerik:RadScheduler>


    protected void RadScheduler1_FormCreated(object sender, SchedulerFormCreatedEventArgs e) 
       
           if (e.Container.Mode == SchedulerFormMode.AdvancedEdit || e.Container.Mode == SchedulerFormMode.AdvancedInsert) 
           
               RadComboBox resLessonComboBox = e.Container.FindControl("ResLesson") as RadComboBox; 
               resLessonComboBox.OnClientSelectedIndexChanged = "OnClientSelectedIndexChanged"
                   
                   
               RadTimePicker endTimePicker = e.Container.FindControl("EndTime") as RadTimePicker; 
               HiddenField1.Value = endTimePicker.ClientID; 
           }  
       }


    Kind regards,
    Peter
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Back to Top