/// <summary> /// Called when the associated control changes. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="ce">A ComponentChangedEventArgs that contains the event data. </param> public override void OnComponentChanged(object sender, System.ComponentModel.Design.ComponentChangedEventArgs ce) { if (ce == null) { throw new ArgumentNullException("ce"); } base.OnComponentChanged(sender, ce); if (ce.Member.Name == "Value") { // user has edited Value property make sure the designer knows that // this means other properties need serializing TimeInputBox control = (TimeInputBox)this.Component; this.RaiseComponentChanged("TimeType", control.TimeType); switch (control.Value.TimeType) { case TimeType.Exact: case TimeType.Approximate: this.RaiseComponentChanged("TimeValue", control.TimeValue); break; case TimeType.NullIndex: this.RaiseComponentChanged("NullIndex", control.NullIndex); break; } } }
/// <summary> /// Determines whether the control specified by the ControlToValidate property is a valid control. /// </summary> /// <returns>True if control properties is valid</returns> protected override bool ControlPropertiesValid() { // Call the base implementation of ControlPropertiesValid first. // If that passes run the extra checks if (base.ControlPropertiesValid() == true) { TimeInputBox control = this.NamingContainer.FindControl(this.ControlToValidate) as TimeInputBox; if (control == null) { throw new HttpException(TimeInputBoxControl.TimeInputBoxValidatorResources.ControlToValidateInvalid); } else { return(true); } } else { return(false); } }