Code:
/ FXUpdate3074 / FXUpdate3074 / 1.1 / DEVDIV / depot / DevDiv / releases / whidbey / QFE / 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. //------------------------------------------------------------------------------ //// 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.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- EventEntry.cs
- MachineSettingsSection.cs
- NonSerializedAttribute.cs
- ZoneLinkButton.cs
- ZipIOZip64EndOfCentralDirectoryLocatorBlock.cs
- BaseServiceProvider.cs
- ProfileInfo.cs
- AspNetCompatibilityRequirementsMode.cs
- PrePrepareMethodAttribute.cs
- XmlDataImplementation.cs
- SiteMembershipCondition.cs
- HatchBrush.cs
- XsltQilFactory.cs
- MultipleViewProviderWrapper.cs
- HttpsTransportElement.cs
- ValidationPropertyAttribute.cs
- UICuesEvent.cs
- SymbolMethod.cs
- RbTree.cs
- FillRuleValidation.cs
- StackSpiller.Temps.cs
- Vars.cs
- COAUTHIDENTITY.cs
- MasterPageBuildProvider.cs
- RetriableClipboard.cs
- MaskedTextProvider.cs
- Converter.cs
- ExpressionWriter.cs
- SafeFileMappingHandle.cs
- SmiRecordBuffer.cs
- EntityEntry.cs
- HtmlTable.cs
- ModuleBuilder.cs
- StoreContentChangedEventArgs.cs
- PageResolution.cs
- SizeAnimationUsingKeyFrames.cs
- GuidTagList.cs
- TransactionManagerProxy.cs
- ContextMenuStrip.cs
- SQLInt32Storage.cs
- DesignColumn.cs
- HtmlTitle.cs
- BrushProxy.cs
- XLinq.cs
- SchemaComplexType.cs
- FontWeightConverter.cs
- SchemaCompiler.cs
- SystemNetHelpers.cs
- InProcStateClientManager.cs
- SchemaName.cs
- HttpRuntimeSection.cs
- Compilation.cs
- CompoundFileStorageReference.cs
- DrawingContextDrawingContextWalker.cs
- WrapperSecurityCommunicationObject.cs
- EventWaitHandleSecurity.cs
- _SslSessionsCache.cs
- SoundPlayer.cs
- TargetException.cs
- DbReferenceCollection.cs
- ApplicationCommands.cs
- followingsibling.cs
- SignatureToken.cs
- VirtualizingPanel.cs
- SplitterPanel.cs
- SqlDataSourceAdvancedOptionsForm.cs
- StartUpEventArgs.cs
- FixedStringLookup.cs
- ColumnWidthChangedEvent.cs
- Point4DConverter.cs
- StateBag.cs
- HandledEventArgs.cs
- RequestCacheValidator.cs
- DataGridTablesFactory.cs
- TypeSystemProvider.cs
- BoundColumn.cs
- ListViewTableRow.cs
- XmlnsCache.cs
- RemotingConfigParser.cs
- ActivityDesignerAccessibleObject.cs
- WindowsNonControl.cs
- WsdlHelpGeneratorElement.cs
- LocalTransaction.cs
- MouseWheelEventArgs.cs
- CompositeDataBoundControl.cs
- ItemsChangedEventArgs.cs
- UnionCqlBlock.cs
- SqlDataSourceView.cs
- SqlUnionizer.cs
- NotCondition.cs
- JoinGraph.cs
- AutomationPatternInfo.cs
- _FtpDataStream.cs
- ConvertersCollection.cs
- IUnknownConstantAttribute.cs
- Window.cs
- CodeMemberEvent.cs
- ProfileParameter.cs
- EncoderBestFitFallback.cs
- WindowsTab.cs