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

Resources Setting Selected Value

1 Answer 63 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
TheLostLeaf
Top achievements
Rank 2
TheLostLeaf asked on 26 Aug 2010, 07:40 PM
Hello,
After much research I still can't figure out how to set the selected value in a resource list. My Resources appear ok, and the correct value is added to the database, but on update, it always selects the 1st data value in the list no matter what the database value. It does not select the "-" unless my data field is null which is correct.

My appointment population loop below.

for (int i = 0; i < appCol.Count; i++)
            {
  
                Appointment apt = new Appointment();
                apt.Owner = owner;
                apt.ID = appCol[i].Id;
                apt.Start = DateTime.SpecifyKind(Convert.ToDateTime(appCol[i].Start), DateTimeKind.Utc);
                apt.End = DateTime.SpecifyKind(Convert.ToDateTime(appCol[i].End), DateTimeKind.Utc);
                apt.RecurrenceRule = Convert.ToString(appCol[i].RecurrenceRule);
                apt.Description = appCol[i].Description;
                // load Apppointment Type Resources
                apt.Resources.AddRange(GetResourcesByType(owner,"Appointment Types"));
             
                if (appCol[i].RecurrenceParentId != null)
                    apt.RecurrenceParentID = appCol[i].RecurrenceParentId;
  
                int reminderTime = 0;
  
                if (Int32.TryParse(appCol[i].Reminder,out reminderTime))
                {
                    Reminder r = new Reminder(reminderTime);
                    apt.Reminders.Add(r);
                    Tools.SetAppointmentsForApplication();
                }
  
                if (apt.RecurrenceParentID != null)
                {
                    apt.RecurrenceState = RecurrenceState.Exception;
                }
                else if (apt.RecurrenceRule != string.Empty)
                {
                    apt.RecurrenceState = RecurrenceState.Master;
                }
  
  
                apt.Subject += appCol[i].Subject;
                appointments.Add(apt);
            }

1 Answer, 1 is accepted

Sort by
0
Accepted
Veronica
Telerik team
answered on 01 Sep 2010, 02:32 PM
Hello TheLostLeaf,

When you add resources via code-behind you'll need a place to store them. That way each appointment will keep the assigned resource and the combobox will select the right item automatically when appointment is to be updated. 
 
In this demo "User" is a resource. Note the UserID property which keeps the information about which User each appointment is assigned to. Please take a look at it and let me know if you have more questions.


Kind regards,
Veronica Milcheva
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Scheduler
Asked by
TheLostLeaf
Top achievements
Rank 2
Answers by
Veronica
Telerik team
Share this question
or