Code:
/ FX-1434 / FX-1434 / 1.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
- HttpHandlerAction.cs
- Item.cs
- PropertyChangedEventArgs.cs
- UnsafeCollabNativeMethods.cs
- TextShapeableCharacters.cs
- ColorIndependentAnimationStorage.cs
- TextPointer.cs
- MD5CryptoServiceProvider.cs
- BasePattern.cs
- FlowchartDesigner.Helpers.cs
- TableLayoutPanelCodeDomSerializer.cs
- WebReferencesBuildProvider.cs
- JournalEntry.cs
- MobileComponentEditorPage.cs
- WebPartEditorApplyVerb.cs
- FileLogRecord.cs
- BulletedListEventArgs.cs
- LineServicesCallbacks.cs
- TailCallAnalyzer.cs
- CodePageEncoding.cs
- SourceFilter.cs
- CheckBoxFlatAdapter.cs
- PageResolution.cs
- PackagePartCollection.cs
- AppDomainUnloadedException.cs
- Matrix.cs
- CodeStatement.cs
- KnownTypes.cs
- CompModHelpers.cs
- ThreadAbortException.cs
- ToolStripStatusLabel.cs
- dtdvalidator.cs
- MetabaseServerConfig.cs
- _AutoWebProxyScriptEngine.cs
- NamespaceMapping.cs
- OutputCacheSettings.cs
- ItemCheckedEvent.cs
- isolationinterop.cs
- WebContext.cs
- MarkerProperties.cs
- ComplexTypeEmitter.cs
- SearchForVirtualItemEventArgs.cs
- SQLInt64.cs
- WbmpConverter.cs
- WebPartHelpVerb.cs
- RecipientInfo.cs
- DataGridViewComboBoxColumn.cs
- Shape.cs
- RecognizedWordUnit.cs
- AstTree.cs
- ExceptionCollection.cs
- FormClosedEvent.cs
- WindowsRichEdit.cs
- ObjectViewEntityCollectionData.cs
- DuplicateContext.cs
- ClientBuildManagerCallback.cs
- ManagementInstaller.cs
- TextSelectionProcessor.cs
- SoapReflectionImporter.cs
- ProfileGroupSettingsCollection.cs
- DataServiceRequestArgs.cs
- SiteMapPath.cs
- TextMetrics.cs
- LocalizationParserHooks.cs
- DecimalConstantAttribute.cs
- GeometryGroup.cs
- NavigationHelper.cs
- BitmapSource.cs
- ImageIndexConverter.cs
- StatusBarPanel.cs
- linebase.cs
- OutputCacheModule.cs
- MenuItemCollection.cs
- PropertyDescriptorCollection.cs
- CommentEmitter.cs
- ImageBrush.cs
- ReservationCollection.cs
- OrElse.cs
- HighlightComponent.cs
- DesignTimeResourceProviderFactoryAttribute.cs
- UnsafeNativeMethods.cs
- SymbolType.cs
- PrimitiveCodeDomSerializer.cs
- Filter.cs
- QuaternionAnimationBase.cs
- CellParaClient.cs
- PropertyCondition.cs
- GregorianCalendarHelper.cs
- TypeUtil.cs
- MissingManifestResourceException.cs
- XsltCompileContext.cs
- ImageList.cs
- DesignerVerbCollection.cs
- CompositeDispatchFormatter.cs
- DBConcurrencyException.cs
- Random.cs
- UserPreferenceChangingEventArgs.cs
- NativeMethods.cs
- IdentifierCreationService.cs
- SiteMapProvider.cs