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
- MyContact.cs
- TimeZoneInfo.cs
- NameNode.cs
- SourceChangedEventArgs.cs
- WS2007HttpBindingElement.cs
- JumpItem.cs
- HttpRuntimeSection.cs
- TimeSpanSecondsConverter.cs
- XsdDataContractImporter.cs
- ToolStripRendererSwitcher.cs
- ThemeDirectoryCompiler.cs
- ActivationServices.cs
- HelloOperation11AsyncResult.cs
- BrowserCapabilitiesFactory.cs
- LingerOption.cs
- JoinElimination.cs
- ApplicationManager.cs
- ProxyWebPartConnectionCollection.cs
- FaultContext.cs
- TagPrefixInfo.cs
- WindowsStatusBar.cs
- ContainerActivationHelper.cs
- RemotingAttributes.cs
- IInstanceTable.cs
- WorkflowMarkupSerializerMapping.cs
- FileDialog_Vista.cs
- AspNetHostingPermission.cs
- ConfigXmlCDataSection.cs
- EventSourceCreationData.cs
- IProvider.cs
- SessionStateModule.cs
- GridViewColumnHeaderAutomationPeer.cs
- ResourceDictionaryCollection.cs
- DataGridViewToolTip.cs
- _ListenerRequestStream.cs
- SafeBitVector32.cs
- TimeSpanMinutesOrInfiniteConverter.cs
- messageonlyhwndwrapper.cs
- _SpnDictionary.cs
- QueryConverter.cs
- OutgoingWebResponseContext.cs
- TypeResolver.cs
- EntityContainerRelationshipSet.cs
- Int32Converter.cs
- SecurityContextSecurityTokenAuthenticator.cs
- RelationalExpressions.cs
- Queue.cs
- BamlStream.cs
- PeerCustomResolverBindingElement.cs
- UserInitiatedNavigationPermission.cs
- Glyph.cs
- DbConnectionPoolIdentity.cs
- CodeMemberProperty.cs
- ColumnWidthChangingEvent.cs
- HtmlButton.cs
- HtmlTableCellCollection.cs
- PersonalizationStateQuery.cs
- HelpEvent.cs
- ISAPIWorkerRequest.cs
- NameGenerator.cs
- COM2IManagedPerPropertyBrowsingHandler.cs
- ComponentCommands.cs
- TextDecorationCollection.cs
- OleDbMetaDataFactory.cs
- ExtendedPropertyDescriptor.cs
- InlineUIContainer.cs
- PenLineJoinValidation.cs
- MoveSizeWinEventHandler.cs
- CollectionBase.cs
- _CacheStreams.cs
- GlyphRunDrawing.cs
- SmiConnection.cs
- Rules.cs
- MutexSecurity.cs
- COAUTHINFO.cs
- OdbcConnectionHandle.cs
- MemoryFailPoint.cs
- PointLightBase.cs
- MatchSingleFxEngineOpcode.cs
- MessageDesigner.cs
- CheckBoxList.cs
- FilterElement.cs
- SqlUnionizer.cs
- ExtenderHelpers.cs
- ObjectQueryState.cs
- ProjectionPruner.cs
- CodeDOMUtility.cs
- SqlCharStream.cs
- MobileCapabilities.cs
- XmlIlTypeHelper.cs
- Command.cs
- XmlSortKeyAccumulator.cs
- IdentityNotMappedException.cs
- ScrollViewer.cs
- BinaryCommonClasses.cs
- Drawing.cs
- RepeatInfo.cs
- SystemDropShadowChrome.cs
- ListViewGroupConverter.cs
- DataKey.cs