Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / 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
- RightsController.cs
- BindingCompleteEventArgs.cs
- SaveWorkflowAsyncResult.cs
- ObjectQueryExecutionPlan.cs
- SHA1Cng.cs
- TokenBasedSet.cs
- CryptoKeySecurity.cs
- EventSchemaTraceListener.cs
- StatusStrip.cs
- DispatchChannelSink.cs
- PointCollectionConverter.cs
- PagesChangedEventArgs.cs
- _SafeNetHandles.cs
- ColorAnimationBase.cs
- OptimalBreakSession.cs
- Mappings.cs
- QilReference.cs
- NullableDoubleAverageAggregationOperator.cs
- CheckBox.cs
- StructuredType.cs
- XmlWrappingWriter.cs
- XmlDataImplementation.cs
- ButtonChrome.cs
- ControlCachePolicy.cs
- BufferCache.cs
- Graphics.cs
- FontWeightConverter.cs
- WCFBuildProvider.cs
- ChannelSinkStacks.cs
- HttpFileCollectionBase.cs
- HuffCodec.cs
- MSAANativeProvider.cs
- BaseDataBoundControl.cs
- XmlSerializerAssemblyAttribute.cs
- MediaElementAutomationPeer.cs
- XmlSerializationWriter.cs
- PrincipalPermission.cs
- ToolStripArrowRenderEventArgs.cs
- KeyedHashAlgorithm.cs
- ConfigXmlAttribute.cs
- NaturalLanguageHyphenator.cs
- TypeElement.cs
- EntityContainerAssociationSet.cs
- StorageAssociationSetMapping.cs
- ViewGenerator.cs
- MbpInfo.cs
- XmlSortKey.cs
- DodSequenceMerge.cs
- DataGridViewCellFormattingEventArgs.cs
- SoundPlayer.cs
- ToolStripPanel.cs
- EncoderFallback.cs
- ConditionalWeakTable.cs
- SID.cs
- TextTreeUndoUnit.cs
- TypedColumnHandler.cs
- FixedSOMGroup.cs
- ACL.cs
- GradientBrush.cs
- ElementNotAvailableException.cs
- DataFormat.cs
- SafeNativeMethods.cs
- EncoderReplacementFallback.cs
- DoubleCollectionConverter.cs
- HttpException.cs
- _ScatterGatherBuffers.cs
- AuthenticationModuleElement.cs
- QilReference.cs
- LayoutExceptionEventArgs.cs
- ConfigXmlText.cs
- DetailsViewDeleteEventArgs.cs
- _HeaderInfoTable.cs
- DefaultBinder.cs
- SpecialFolderEnumConverter.cs
- formatter.cs
- RowUpdatedEventArgs.cs
- PassportIdentity.cs
- MouseBinding.cs
- xmlfixedPageInfo.cs
- TrustLevel.cs
- LoginNameDesigner.cs
- Variable.cs
- SqlDataSourceSelectingEventArgs.cs
- XmlSequenceWriter.cs
- NameValuePermission.cs
- WindowsTitleBar.cs
- CallContext.cs
- StrokeCollectionConverter.cs
- QuaternionRotation3D.cs
- ComponentRenameEvent.cs
- UpdateCommandGenerator.cs
- EventProxy.cs
- TimeSpan.cs
- DbParameterHelper.cs
- _Win32.cs
- IntegerValidator.cs
- InputBindingCollection.cs
- ProfileGroupSettingsCollection.cs
- LoadedEvent.cs
- HandleInitializationContext.cs