Code:
/ FXUpdate3074 / FXUpdate3074 / 1.1 / DEVDIV / depot / DevDiv / releases / whidbey / QFE / 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. //------------------------------------------------------------------------------ //// 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.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- SharedStatics.cs
- OracleConnectionString.cs
- OutOfMemoryException.cs
- MobileSysDescriptionAttribute.cs
- InkCollectionBehavior.cs
- SemanticKeyElement.cs
- AuthenticationServiceManager.cs
- TargetParameterCountException.cs
- ReliabilityContractAttribute.cs
- ProfessionalColors.cs
- ProviderConnectionPoint.cs
- SystemColors.cs
- OptimalTextSource.cs
- MonitorWrapper.cs
- ProfilePropertyMetadata.cs
- PageThemeParser.cs
- ExtenderProvidedPropertyAttribute.cs
- FunctionDescription.cs
- SerialStream.cs
- CodeAccessPermission.cs
- XPathMessageFilterElementComparer.cs
- FileDialogCustomPlacesCollection.cs
- DynamicPropertyReader.cs
- XPathNodeHelper.cs
- RIPEMD160.cs
- BamlLocalizer.cs
- ManagementOperationWatcher.cs
- ellipse.cs
- SyndicationLink.cs
- NCryptNative.cs
- TaiwanCalendar.cs
- storepermissionattribute.cs
- Path.cs
- TextChangedEventArgs.cs
- FieldBuilder.cs
- SimpleApplicationHost.cs
- EncoderNLS.cs
- WebPartCloseVerb.cs
- WebCategoryAttribute.cs
- ConfigXmlCDataSection.cs
- SecurityPermission.cs
- StdValidatorsAndConverters.cs
- EntitySqlQueryBuilder.cs
- DataGridColumnHeaderAutomationPeer.cs
- InvalidFilterCriteriaException.cs
- TypeDefinition.cs
- OrderedDictionaryStateHelper.cs
- SqlUserDefinedTypeAttribute.cs
- CopyNodeSetAction.cs
- AncillaryOps.cs
- KeyPressEvent.cs
- X509Extension.cs
- SectionXmlInfo.cs
- CollectionExtensions.cs
- WmlPageAdapter.cs
- IdentitySection.cs
- XmlJsonWriter.cs
- GifBitmapEncoder.cs
- DataGridViewTopLeftHeaderCell.cs
- MultipleViewPatternIdentifiers.cs
- DataGridItemAttachedStorage.cs
- HtmlShimManager.cs
- StringReader.cs
- ToolStripHighContrastRenderer.cs
- UserControlParser.cs
- DateTimeOffsetConverter.cs
- XmlExceptionHelper.cs
- PropertyValueChangedEvent.cs
- XsltContext.cs
- CDSCollectionETWBCLProvider.cs
- LinqDataSourceContextEventArgs.cs
- ScrollItemPattern.cs
- GeneralTransform3D.cs
- TimeSpanMinutesOrInfiniteConverter.cs
- UrlRoutingHandler.cs
- OrElse.cs
- TimeBoundedCache.cs
- XmlSchemaIdentityConstraint.cs
- Ops.cs
- SafeNativeMethodsMilCoreApi.cs
- Stack.cs
- ProtocolsConfigurationHandler.cs
- HandleRef.cs
- Vector3DAnimationUsingKeyFrames.cs
- MergeFailedEvent.cs
- CustomValidator.cs
- EventLogger.cs
- TreeViewHitTestInfo.cs
- ObjectStorage.cs
- TextElementEnumerator.cs
- Types.cs
- ComponentSerializationService.cs
- ParameterSubsegment.cs
- StateMachineWorkflow.cs
- MouseActionValueSerializer.cs
- RtType.cs
- ThaiBuddhistCalendar.cs
- SelectionGlyphBase.cs
- XPathPatternBuilder.cs
- DbModificationCommandTree.cs