Code:
/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / 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())); } } }
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- CalendarKeyboardHelper.cs
- PageAsyncTask.cs
- FrameworkElement.cs
- MetadataArtifactLoaderResource.cs
- ImmutablePropertyDescriptorGridEntry.cs
- CacheEntry.cs
- ShapingEngine.cs
- CodeGeneratorOptions.cs
- SqlGatherConsumedAliases.cs
- PhysicalFontFamily.cs
- NumberSubstitution.cs
- DerivedKeySecurityToken.cs
- MobileUserControl.cs
- UriTemplateVariablePathSegment.cs
- SqlRetyper.cs
- SqlInternalConnectionSmi.cs
- CodeConstructor.cs
- GenericPrincipal.cs
- safelink.cs
- DataGridViewCellParsingEventArgs.cs
- SamlDelegatingWriter.cs
- PersonalizationAdministration.cs
- Attribute.cs
- Object.cs
- SimpleWebHandlerParser.cs
- HtmlGenericControl.cs
- InternalReceiveMessage.cs
- CollectionEditor.cs
- TrustSection.cs
- CallbackTimeoutsBehavior.cs
- DesignerContextDescriptor.cs
- TextView.cs
- WebPartConnection.cs
- AttributedMetaModel.cs
- ObjectView.cs
- KeyValueSerializer.cs
- WindowsFormsHostPropertyMap.cs
- XmlCollation.cs
- JsonFormatWriterGenerator.cs
- InputLanguageCollection.cs
- QueryCreatedEventArgs.cs
- WCFModelStrings.Designer.cs
- StackBuilderSink.cs
- ImpersonateTokenRef.cs
- FamilyMapCollection.cs
- XPathScanner.cs
- NavigateEvent.cs
- documentsequencetextpointer.cs
- SBCSCodePageEncoding.cs
- PerspectiveCamera.cs
- UrlAuthFailedErrorFormatter.cs
- VisualCollection.cs
- BindingCollection.cs
- FaultDesigner.cs
- WriteableOnDemandPackagePart.cs
- CollectionViewGroupRoot.cs
- InputLanguageSource.cs
- XPathPatternParser.cs
- BitmapCacheBrush.cs
- MemoryMappedViewStream.cs
- HttpServerVarsCollection.cs
- PasswordTextNavigator.cs
- RemotingAttributes.cs
- Triplet.cs
- ConditionedDesigner.cs
- PathData.cs
- ImageMap.cs
- SecurityKeyIdentifier.cs
- UnmanagedHandle.cs
- ListBindingConverter.cs
- DragDrop.cs
- XsdSchemaFileEditor.cs
- DataSourceProvider.cs
- PolygonHotSpot.cs
- XmlSecureResolver.cs
- StringExpressionSet.cs
- UserControl.cs
- ReadOnlyObservableCollection.cs
- Size.cs
- TextFormatterHost.cs
- odbcmetadatacolumnnames.cs
- COM2TypeInfoProcessor.cs
- ReferenceEqualityComparer.cs
- StylusPointPropertyInfo.cs
- WebPartAuthorizationEventArgs.cs
- PermissionListSet.cs
- BamlLocalizabilityResolver.cs
- PropertyOverridesTypeEditor.cs
- HttpResponseWrapper.cs
- IdentifierService.cs
- QueryOperatorEnumerator.cs
- TagMapInfo.cs
- RedBlackList.cs
- SystemIcmpV4Statistics.cs
- ObjectListDataBindEventArgs.cs
- FormViewPageEventArgs.cs
- RelOps.cs
- XPathScanner.cs
- HttpContext.cs
- AutomationPatternInfo.cs