Exemple #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);
            }
        }
        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;

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

                if ( rExtras.Items.Count > Item.ItemIndex )
                {
                    RepeaterItem extraItem = rExtras.Items[Item.ItemIndex];
                    DefinedValuePicker ability = extraItem.FindControl( "dvpAbilityLevel" ) as DefinedValuePicker;
                    RockTextBox allergy = extraItem.FindControl( "rtbAllergy" ) as RockTextBox;
                    RockTextBox legal = extraItem.FindControl( "rtbLegalNotes" ) as RockTextBox;

                    kidData.AbilityLevel = DefinedValueCache.Read( ability.SelectedValueAsId() ?? -1 );
                    kidData.Allergy = allergy.Text;
                    kidData.LegalNotes = legal.Text;
                }

                kidsList.Add( kidData );
            }
        }