Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / ndp / fx / src / xsp / System / Web / UI / WebControls / RequiredFieldValidator.cs / 1 / RequiredFieldValidator.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- /* */ namespace System.Web.UI.WebControls { using System.ComponentModel; using System.Web; using System.Security.Permissions; using System.Web.Util; ////// [ ToolboxData("<{0}:RequiredFieldValidator runat=\"server\" ErrorMessage=\"RequiredFieldValidator\">{0}:RequiredFieldValidator>") ] [AspNetHostingPermission(SecurityAction.LinkDemand, Level=AspNetHostingPermissionLevel.Minimal)] [AspNetHostingPermission(SecurityAction.InheritanceDemand, Level=AspNetHostingPermissionLevel.Minimal)] public class RequiredFieldValidator : BaseValidator { ///Checks if the value of /// the associated input control is different from its initial value. ////// [ WebCategory("Behavior"), Themeable(false), DefaultValue(""), WebSysDescription(SR.RequiredFieldValidator_InitialValue) ] public string InitialValue { get { object o = ViewState["InitialValue"]; return((o == null) ? String.Empty : (string)o); } set { ViewState["InitialValue"] = value; } } ///Gets or sets the initial value of the associated input control. ////// /// AddAttributesToRender method /// protected override void AddAttributesToRender(HtmlTextWriter writer) { base.AddAttributesToRender(writer); if (RenderUplevel) { string id = ClientID; HtmlTextWriter expandoAttributeWriter = (EnableLegacyRendering) ? writer : null; AddExpandoAttribute(expandoAttributeWriter, id, "evaluationfunction", "RequiredFieldValidatorEvaluateIsValid", false); AddExpandoAttribute(expandoAttributeWriter, id, "initialvalue", InitialValue); } } ////// /// EvaluateIsValid method /// protected override bool EvaluateIsValid() { // Get the control value, return true if it is not found string controlValue = GetControlValidationValue(ControlToValidate); if (controlValue == null) { Debug.Fail("Should have been caught by PropertiesValid check"); return true; } // See if the control has changed return(!controlValue.Trim().Equals(InitialValue.Trim())); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- /* */ namespace System.Web.UI.WebControls { using System.ComponentModel; using System.Web; using System.Security.Permissions; using System.Web.Util; ////// [ ToolboxData("<{0}:RequiredFieldValidator runat=\"server\" ErrorMessage=\"RequiredFieldValidator\">{0}:RequiredFieldValidator>") ] [AspNetHostingPermission(SecurityAction.LinkDemand, Level=AspNetHostingPermissionLevel.Minimal)] [AspNetHostingPermission(SecurityAction.InheritanceDemand, Level=AspNetHostingPermissionLevel.Minimal)] public class RequiredFieldValidator : BaseValidator { ///Checks if the value of /// the associated input control is different from its initial value. ////// [ WebCategory("Behavior"), Themeable(false), DefaultValue(""), WebSysDescription(SR.RequiredFieldValidator_InitialValue) ] public string InitialValue { get { object o = ViewState["InitialValue"]; return((o == null) ? String.Empty : (string)o); } set { ViewState["InitialValue"] = value; } } ///Gets or sets the initial value of the associated input control. ////// /// AddAttributesToRender method /// protected override void AddAttributesToRender(HtmlTextWriter writer) { base.AddAttributesToRender(writer); if (RenderUplevel) { string id = ClientID; HtmlTextWriter expandoAttributeWriter = (EnableLegacyRendering) ? writer : null; AddExpandoAttribute(expandoAttributeWriter, id, "evaluationfunction", "RequiredFieldValidatorEvaluateIsValid", false); AddExpandoAttribute(expandoAttributeWriter, id, "initialvalue", InitialValue); } } ////// /// EvaluateIsValid method /// protected override bool EvaluateIsValid() { // Get the control value, return true if it is not found string controlValue = GetControlValidationValue(ControlToValidate); if (controlValue == null) { Debug.Fail("Should have been caught by PropertiesValid check"); return true; } // See if the control has changed return(!controlValue.Trim().Equals(InitialValue.Trim())); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- OutputCacheProfileCollection.cs
- PolicyValidationException.cs
- Decimal.cs
- FormsAuthenticationModule.cs
- SqlDataSourceSelectingEventArgs.cs
- WindowsGraphics.cs
- HttpAsyncResult.cs
- DLinqTableProvider.cs
- PackageFilter.cs
- SessionStateItemCollection.cs
- SmiGettersStream.cs
- IndexOutOfRangeException.cs
- ComponentSerializationService.cs
- PasswordRecoveryDesigner.cs
- CounterSetInstance.cs
- FacetDescriptionElement.cs
- PerformanceCounterPermissionAttribute.cs
- ToolStripContainer.cs
- StorageModelBuildProvider.cs
- ResXFileRef.cs
- CodeEntryPointMethod.cs
- WorkflowRuntimeService.cs
- UpdateCommand.cs
- IIS7WorkerRequest.cs
- BindingElementCollection.cs
- WebPermission.cs
- Transform3DGroup.cs
- SqlPersonalizationProvider.cs
- SkewTransform.cs
- WsrmTraceRecord.cs
- HostedTransportConfigurationManager.cs
- ShaderEffect.cs
- mediaeventshelper.cs
- SHA512.cs
- HtmlProps.cs
- FormViewInsertedEventArgs.cs
- ConfigXmlElement.cs
- ExpressionTable.cs
- Decorator.cs
- ConfigurationPermission.cs
- OletxTransactionFormatter.cs
- LockedAssemblyCache.cs
- WebFormDesignerActionService.cs
- SiteMapNodeCollection.cs
- DesignTable.cs
- SHA512Managed.cs
- StyleBamlTreeBuilder.cs
- ConfigXmlAttribute.cs
- QueryOperationResponseOfT.cs
- IgnorePropertiesAttribute.cs
- BitmapImage.cs
- BindingValueChangedEventArgs.cs
- HttpListenerPrefixCollection.cs
- ToolBarPanel.cs
- SizeAnimation.cs
- VisualStateChangedEventArgs.cs
- RotateTransform3D.cs
- DoubleCollection.cs
- XmlSchemaComplexContentExtension.cs
- GridViewSortEventArgs.cs
- ExceptionHandlerDesigner.cs
- WinInetCache.cs
- TypedColumnHandler.cs
- ZipIOExtraFieldPaddingElement.cs
- ClientRolePrincipal.cs
- GifBitmapDecoder.cs
- DocumentCollection.cs
- AppendHelper.cs
- ListControl.cs
- ConstNode.cs
- TableDesigner.cs
- TimeoutStream.cs
- SQLGuidStorage.cs
- ImmutableClientRuntime.cs
- DecoratedNameAttribute.cs
- UxThemeWrapper.cs
- FileAuthorizationModule.cs
- BasicExpandProvider.cs
- Binding.cs
- DocumentCollection.cs
- QuaternionRotation3D.cs
- LinkTarget.cs
- TextParagraphView.cs
- ReadOnlyTernaryTree.cs
- CustomAttribute.cs
- FormsAuthenticationConfiguration.cs
- WindowsButton.cs
- MasterPageCodeDomTreeGenerator.cs
- HttpPostedFile.cs
- XmlSchemaFacet.cs
- SHA256CryptoServiceProvider.cs
- OutputCacheSettingsSection.cs
- XmlSchemaInclude.cs
- DataGridViewColumnCollection.cs
- Assign.cs
- MissingManifestResourceException.cs
- regiisutil.cs
- WebDescriptionAttribute.cs
- BackgroundFormatInfo.cs
- WebPartConnectionsCancelVerb.cs