Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / 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
- SystemMulticastIPAddressInformation.cs
- NotifyParentPropertyAttribute.cs
- TransactionFlowProperty.cs
- MemoryResponseElement.cs
- ExpressionVisitor.cs
- FixUp.cs
- PageEventArgs.cs
- AddInIpcChannel.cs
- PageCatalogPart.cs
- InputChannel.cs
- LabelLiteral.cs
- NegationPusher.cs
- ByteAnimationBase.cs
- ActivityValidator.cs
- DoubleKeyFrameCollection.cs
- HttpChannelListener.cs
- TextEndOfParagraph.cs
- Button.cs
- ZipFileInfo.cs
- FileDialogCustomPlace.cs
- JsonFormatReaderGenerator.cs
- ServiceNameElementCollection.cs
- Interlocked.cs
- SchemaTypeEmitter.cs
- AvTraceFormat.cs
- CodeExpressionCollection.cs
- MobileControlBuilder.cs
- RelatedCurrencyManager.cs
- OrthographicCamera.cs
- IdentifierCollection.cs
- ExpressionQuoter.cs
- CryptoApi.cs
- VarRemapper.cs
- DBCommandBuilder.cs
- DataBindingExpressionBuilder.cs
- ExpressionConverter.cs
- CacheDependency.cs
- documentation.cs
- SystemInfo.cs
- StackSpiller.Generated.cs
- TextTreeTextBlock.cs
- SelectionRange.cs
- CompiledXpathExpr.cs
- FullTrustAssemblyCollection.cs
- CoTaskMemSafeHandle.cs
- Expressions.cs
- MailMessage.cs
- SpellerHighlightLayer.cs
- DefaultTextStore.cs
- HMACRIPEMD160.cs
- BamlResourceContent.cs
- PropertyConverter.cs
- ServicesUtilities.cs
- AssertFilter.cs
- BufferModesCollection.cs
- TextBoxRenderer.cs
- ToggleButtonAutomationPeer.cs
- FlowDocumentView.cs
- PrintControllerWithStatusDialog.cs
- EventTrigger.cs
- DesignerVerb.cs
- StreamInfo.cs
- SqlBooleanMismatchVisitor.cs
- TableCell.cs
- EventArgs.cs
- SynchronizedPool.cs
- ChangePassword.cs
- ScalarOps.cs
- DropSource.cs
- ByteStack.cs
- FrameAutomationPeer.cs
- WebEventTraceProvider.cs
- Mapping.cs
- SHA256CryptoServiceProvider.cs
- OutputCacheSection.cs
- UserControlCodeDomTreeGenerator.cs
- XmlCharType.cs
- Codec.cs
- WebPartEventArgs.cs
- FileLoadException.cs
- ArgumentNullException.cs
- DockAndAnchorLayout.cs
- ProcessProtocolHandler.cs
- InvalidContentTypeException.cs
- UInt64Storage.cs
- Aggregates.cs
- SqlProfileProvider.cs
- InvalidAsynchronousStateException.cs
- ModelUtilities.cs
- JumpPath.cs
- RegexNode.cs
- Vector3DCollectionConverter.cs
- AlternateView.cs
- DocumentPaginator.cs
- CacheOutputQuery.cs
- InkCanvas.cs
- SQLGuid.cs
- ProtocolsConfigurationEntry.cs
- FormatterConverter.cs
- CustomActivityDesigner.cs