From 67e9d80a7bb48bb21fbf0af446270d6219c7c267 Mon Sep 17 00:00:00 2001 From: eeichinger Date: Thu, 16 Apr 2009 21:17:04 +0000 Subject: [PATCH] fixed broken build --- .../UI/Controls/AbstractValidationControl.cs | 37 ++++++++++++++++--- 1 file changed, 32 insertions(+), 5 deletions(-) diff --git a/src/Spring/Spring.Web/Web/UI/Controls/AbstractValidationControl.cs b/src/Spring/Spring.Web/Web/UI/Controls/AbstractValidationControl.cs index 7ee5acf0..744a0c32 100644 --- a/src/Spring/Spring.Web/Web/UI/Controls/AbstractValidationControl.cs +++ b/src/Spring/Spring.Web/Web/UI/Controls/AbstractValidationControl.cs @@ -20,7 +20,6 @@ #region Imports -using System; using System.Collections; using System.Web.UI; using Spring.Context; @@ -41,6 +40,34 @@ namespace Spring.Web.UI.Controls private string provider; private IValidationErrorsRenderer renderer; +#if !NET_2_0 + private bool initialized; + + protected override void OnInit(System.EventArgs e) + { + initialized = true; + base.OnInit(e); + } + + /// + /// Gets a value indicating whether this instance is in design mode. + /// + /// + /// true if this instance is in design mode; otherwise, false. + /// + protected bool DesignMode + { + get + { + if (this.Site != null) + { + return this.Site.DesignMode; + } + return (this.Context == null) && initialized; + } + } +#endif + /// /// Gets or sets the provider. /// @@ -99,7 +126,7 @@ namespace Spring.Web.UI.Controls /// protected virtual IMessageSource MessageSource { - get { return ValidationContainer==null ? null : ValidationContainer.MessageSource; } + get { return ValidationContainer == null ? null : ValidationContainer.MessageSource; } } /// @@ -116,15 +143,15 @@ namespace Spring.Web.UI.Controls { get { - for(Control parent=this.Parent; parent!=null; parent=parent.Parent) + for (Control parent = this.Parent; parent != null; parent = parent.Parent) { IValidationContainer container = parent as IValidationContainer; if (container != null) { return container; - } + } } -// throw new NotSupportedException(string.Format("Controls of Type {0} must be placed on a container control implementing IValidationContainer", this.GetType().Name)); + // throw new NotSupportedException(string.Format("Controls of Type {0} must be placed on a container control implementing IValidationContainer", this.GetType().Name)); return null; } }