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
- RenderDataDrawingContext.cs
- ApplicationTrust.cs
- AffineTransform3D.cs
- HttpModuleActionCollection.cs
- PublisherMembershipCondition.cs
- XmlException.cs
- PrivateFontCollection.cs
- XmlILConstructAnalyzer.cs
- Utils.cs
- XmlAttributeCache.cs
- QueryReaderSettings.cs
- IdentityVerifier.cs
- TimeSpan.cs
- DbProviderFactories.cs
- HMAC.cs
- CompiledQuery.cs
- IImplicitResourceProvider.cs
- OneOfTypeConst.cs
- Ray3DHitTestResult.cs
- ErrorProvider.cs
- FamilyCollection.cs
- __FastResourceComparer.cs
- DetailsViewInsertEventArgs.cs
- EdgeProfileValidation.cs
- CustomWebEventKey.cs
- WmpBitmapDecoder.cs
- InputMethodStateTypeInfo.cs
- ContractAdapter.cs
- ColorConvertedBitmap.cs
- ParserHooks.cs
- XmlSchemaInfo.cs
- IChannel.cs
- NavigationPropertySingletonExpression.cs
- ApplicationFileCodeDomTreeGenerator.cs
- UInt32Converter.cs
- LocalFileSettingsProvider.cs
- WindowsTreeView.cs
- WebPartAddingEventArgs.cs
- SerialPort.cs
- Pool.cs
- XmlNamespaceMappingCollection.cs
- XmlHierarchicalEnumerable.cs
- AutomationPattern.cs
- SafeMemoryMappedViewHandle.cs
- ExchangeUtilities.cs
- ResourcePermissionBaseEntry.cs
- CollectionChangedEventManager.cs
- SoapIgnoreAttribute.cs
- EditorPart.cs
- InputLanguageSource.cs
- TabControlCancelEvent.cs
- DataGridViewCellMouseEventArgs.cs
- SubclassTypeValidatorAttribute.cs
- FrameworkTextComposition.cs
- ColumnWidthChangingEvent.cs
- ClientSettingsSection.cs
- Size.cs
- XmlElementAttributes.cs
- CategoryGridEntry.cs
- DataRelationPropertyDescriptor.cs
- CompilationLock.cs
- DataContractJsonSerializerOperationBehavior.cs
- ZoomPercentageConverter.cs
- PriorityQueue.cs
- GeometryValueSerializer.cs
- Attributes.cs
- ParameterDataSourceExpression.cs
- PagedDataSource.cs
- StretchValidation.cs
- PassportPrincipal.cs
- DesignerDataStoredProcedure.cs
- WebPermission.cs
- ArrayTypeMismatchException.cs
- RectangleGeometry.cs
- DefaultPropertyAttribute.cs
- UIEndRequest.cs
- HwndSubclass.cs
- SetIterators.cs
- MergePropertyDescriptor.cs
- GlyphRun.cs
- UnsafePeerToPeerMethods.cs
- XmlAttribute.cs
- NumberFormatter.cs
- AspCompat.cs
- SamlConstants.cs
- SoapDocumentServiceAttribute.cs
- XmlSchemaElement.cs
- ThemeableAttribute.cs
- ScaleTransform.cs
- DbConnectionPool.cs
- IgnoreDataMemberAttribute.cs
- FormsAuthenticationConfiguration.cs
- PTManager.cs
- RuntimeComponentFilter.cs
- ChangeBlockUndoRecord.cs
- TextRangeAdaptor.cs
- pingexception.cs
- PtsCache.cs
- VisualStyleInformation.cs
- AppDomainUnloadedException.cs