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

[Solved] edit operation

1 Answer 146 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
ChiragP
Top achievements
Rank 1
ChiragP asked on 03 Jan 2008, 10:50 AM
Hi
     Support Team,

the example given by you is really helpful. i have query regarding the edit operation. when we double click the appointment it will take us in edit mode, now in edit mode in our example has dropdown for room and user, now my question is can i use some other control like textbox, checkbox... with different title than "room" or "user".

the other thing is can we use more than the 2 "room" and "user" in edit mode?

Thnaking you in advance
Chirag

1 Answer, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 08 Jan 2008, 09:34 AM
Hi Chirag,

Yes, this is possible with Templates. As for the second question, you can have multiple resource values per appointment only with a custom provider. Please, refer to the Multiple Resource Values online example.

Also, please, consider the Database Scheduler Provider example and try the following code with it:

<AdvancedEditTemplate>    
                <asp:TextBox ID="TitleTextBox" Rows="5" Columns="20" runat="server" Text='<%# Bind("Subject") %>'    
                    Width="95%" TextMode="MultiLine"></asp:TextBox>    
                <div style="position: relative">     
                    <span>Teachers:</span><br />    
                    <asp:CheckBoxList ID="TeachersCheckBoxList" runat="server">     
                    </asp:CheckBoxList>    
                </div>    
                <br />    
                <br />    
                <div>    
                    <span>Students:</span><br />    
                    <asp:CheckBoxList ID="StudentsCheckBoxList" runat="server">     
                    </asp:CheckBoxList>    
                </div>    
                <asp:LinkButton ID="UpdateButton" runat="server" Text="Update" CommandName="Update" />    
            </AdvancedEditTemplate>    
 

protected void RadScheduler1_FormCreated(object sender, SchedulerFormCreatedEventArgs e)     
        {     
               
            CheckBoxList teachers = (CheckBoxList)e.Container.FindControl("TeachersCheckBoxList");     
                    
               foreach (Resource r in RadScheduler1.Resources.GetResourcesByType("Teacher"))     
                {     
                   ListItem listitem1 = new ListItem(r.Text, r.Key.ToString());     
                   listitem1.Selected = ResourceIsInUse(r, e.Appointment);     
                   teachers.Items.Add(listitem1);     
                       
                }     
                CheckBoxList students = (CheckBoxList)e.Container.FindControl("StudentsCheckBoxList");     
    
                foreach (Resource r in RadScheduler1.Resources.GetResourcesByType("Student"))     
                {     
                    ListItem listitem1 = new ListItem(r.Text, r.Key.ToString());     
                    listitem1.Selected = ResourceIsInUse(r, e.Appointment);     
                    students.Items.Add(listitem1);     
                       
                }     
      
                
        }     
        private bool ResourceIsInUse(Resource res, Appointment a)     
        {     
            foreach (Resource appRes in a.Resources)     
            {     
                if (res == appRes)     
                {     
                    return true;     
                }     
            }     
    
            return false;     
        }     
        protected void RadScheduler1_AppointmentCommand(object sender, AppointmentCommandEventArgs e)     
        {     
            CheckBoxList teachers = (CheckBoxList)e.Container.FindControl("TeachersCheckBoxList");     
            CheckBoxList students = (CheckBoxList)e.Container.FindControl("StudentsCheckBoxList");     
            e.Container.Appointment.Resources.Clear();     
                 
                 
                foreach (ListItem item1 in teachers.Items)     
                {     
                    if (item1.Selected)     
                    {     
                        Resource teacher = RadScheduler1.Resources.GetResource("Teacher"int.Parse(item1.Value));     
                        e.Container.Appointment.Resources.Add(teacher);     
                    }       
                }     
                
               foreach (ListItem item1 in students.Items)     
                {     
                    if (item1.Selected)     
                    {     
                        Resource student = RadScheduler1.Resources.GetResource("Student"int.Parse(item1.Value));     
                        e.Container.Appointment.Resources.Add(student);     
                         
                    }                            
                }               
        }    
 



All the best,
Peter
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Scheduler
Asked by
ChiragP
Top achievements
Rank 1
Answers by
Peter
Telerik team
Share this question
or