Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / xsp / System / Web / UI / WebControls / RequiredFieldValidator.cs / 1305376 / RequiredFieldValidator.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- /* */ namespace System.Web.UI.WebControls { using System.ComponentModel; using System.Web; using System.Web.Util; ////// [ ToolboxData("<{0}:RequiredFieldValidator runat=\"server\" ErrorMessage=\"RequiredFieldValidator\">{0}:RequiredFieldValidator>") ] 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.Web.Util; ////// [ ToolboxData("<{0}:RequiredFieldValidator runat=\"server\" ErrorMessage=\"RequiredFieldValidator\">{0}:RequiredFieldValidator>") ] 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
- PageContentCollection.cs
- Utils.cs
- ClientProxyGenerator.cs
- ScrollPatternIdentifiers.cs
- StringUtil.cs
- AssemblyGen.cs
- SHA512Cng.cs
- JavaScriptString.cs
- XPathItem.cs
- StyleHelper.cs
- PointKeyFrameCollection.cs
- ZipIOExtraFieldPaddingElement.cs
- COM2ColorConverter.cs
- AssemblyFilter.cs
- DiagnosticStrings.cs
- DisplayInformation.cs
- JapaneseLunisolarCalendar.cs
- WindowsSlider.cs
- MessageDecoder.cs
- ChannelDispatcher.cs
- StatusBar.cs
- KnownTypesProvider.cs
- ToolStripDropDown.cs
- HyperlinkAutomationPeer.cs
- RegexMatchCollection.cs
- prompt.cs
- ManagedWndProcTracker.cs
- Span.cs
- CatalogPartCollection.cs
- EntityViewContainer.cs
- XMLDiffLoader.cs
- IntegrationExceptionEventArgs.cs
- WebPartAuthorizationEventArgs.cs
- CreateParams.cs
- DbProviderFactories.cs
- ObjectStateEntryDbUpdatableDataRecord.cs
- ReceiveContent.cs
- WindowProviderWrapper.cs
- CachedCompositeFamily.cs
- DesignerForm.cs
- XPathConvert.cs
- MessageTransmitTraceRecord.cs
- COM2PropertyBuilderUITypeEditor.cs
- DataGridViewSelectedColumnCollection.cs
- NumberSubstitution.cs
- CodeTypeDeclarationCollection.cs
- QuotaExceededException.cs
- DocumentSchemaValidator.cs
- StagingAreaInputItem.cs
- PropertyKey.cs
- CellLabel.cs
- InputLangChangeEvent.cs
- LedgerEntryCollection.cs
- PersonalizationProviderHelper.cs
- RightNameExpirationInfoPair.cs
- SQLConvert.cs
- ProcessHostConfigUtils.cs
- AttachedPropertyBrowsableAttribute.cs
- XmlHierarchicalDataSourceView.cs
- FontWeight.cs
- RemotingServices.cs
- AssemblyCollection.cs
- LocalServiceSecuritySettingsElement.cs
- DataServiceHostFactory.cs
- PngBitmapEncoder.cs
- FlowLayout.cs
- SqlClientPermission.cs
- SimpleRecyclingCache.cs
- TabControlEvent.cs
- SystemTcpConnection.cs
- AnnotationHighlightLayer.cs
- WorkflowItemPresenter.cs
- FileUpload.cs
- MtomMessageEncodingElement.cs
- KerberosSecurityTokenAuthenticator.cs
- StrokeRenderer.cs
- PasswordDeriveBytes.cs
- DataChangedEventManager.cs
- ApplicationCommands.cs
- BindingListCollectionView.cs
- BinHexEncoder.cs
- ComponentEditorPage.cs
- PersonalizationState.cs
- DesignerDataStoredProcedure.cs
- ZipIOCentralDirectoryBlock.cs
- IDictionary.cs
- TemplateKeyConverter.cs
- ResourceLoader.cs
- Journal.cs
- Int32CollectionConverter.cs
- ValidationErrorEventArgs.cs
- CustomAttributeBuilder.cs
- AnnotationHelper.cs
- ExternalException.cs
- RuleConditionDialog.cs
- ConsumerConnectionPoint.cs
- X509AsymmetricSecurityKey.cs
- Scripts.cs
- ContentPropertyAttribute.cs
- SystemResources.cs