示例#1
0
        protected void loadKids()
        {
            kidsList.Clear();
            foreach (RepeaterItem Item in rKids.Items)
            {
                RockTextBox         firstName = Item.FindControl("rtpKidFirstName") as RockTextBox;
                RockTextBox         lastName  = Item.FindControl("rtpKidLastName") as RockTextBox;
                RockRadioButtonList gender    = Item.FindControl("rblGender") as RockRadioButtonList;
                DatePicker          birthdate = Item.FindControl("dpBirthdate") as DatePicker;
                GradePicker         grade     = Item.FindControl("gpGrade") as GradePicker;
                RockTextBox         allergy   = Item.FindControl("rtbAllergy") as RockTextBox;

                var kidData = new KidData
                {
                    FirstName = firstName.Text,
                    LastName  = lastName.Text,
                    Gender    = gender.SelectedValueAsEnum <Gender>(Gender.Unknown),
                    Birthdate = birthdate.SelectedDate,
                    Grade     = grade.SelectedGradeValue,
                    Allergy   = allergy.Text
                };

                kidsList.Add(kidData);
            }
        }
        /// <summary>
        /// Gets the selection.
        /// </summary>
        /// <param name="controls">The controls.</param>
        /// <returns></returns>
        public override string GetSelection(System.Web.UI.Control[] controls)
        {
            if (controls.Count() == 1)
            {
                RockRadioButtonList rblShowAsLinkType = controls[0] as RockRadioButtonList;
                if (rblShowAsLinkType != null)
                {
                    return(string.Format("{0}", rblShowAsLinkType.SelectedValueAsEnum <ShowAsLinkType>().ConvertToInt()));
                }
            }

            return(string.Empty);
        }