Resources Setting Selected Value

2 posts, 1 answers
  1. TheLostLeaf
    TheLostLeaf avatar
    34 posts
    Member since:
    Feb 2007

    Posted 26 Aug 2010 Link to this post

    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);
                }
  2. Answer
    Veronica
    Admin
    Veronica avatar
    1213 posts

    Posted 01 Sep 2010 Link to this post

    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
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top