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
- Filter.cs
- ApplicationGesture.cs
- SqlServer2KCompatibilityAnnotation.cs
- WpfMemberInvoker.cs
- ValidationEventArgs.cs
- CollectionEditorDialog.cs
- shaperfactoryquerycachekey.cs
- NetPipeSectionData.cs
- TreeViewImageIndexConverter.cs
- PersonalizableAttribute.cs
- TextServicesPropertyRanges.cs
- HtmlImage.cs
- ConfigurationSchemaErrors.cs
- StringCollectionEditor.cs
- ComplusTypeValidator.cs
- OledbConnectionStringbuilder.cs
- PageThemeBuildProvider.cs
- Rect3DConverter.cs
- InternalSendMessage.cs
- ActivityTypeResolver.xaml.cs
- DebugManager.cs
- LogLogRecordHeader.cs
- MessageSecurityOverTcpElement.cs
- FormClosingEvent.cs
- PageClientProxyGenerator.cs
- CryptoApi.cs
- compensatingcollection.cs
- UnknownWrapper.cs
- ProcessThreadCollection.cs
- SqlTrackingService.cs
- Rights.cs
- TextServicesCompartmentEventSink.cs
- FixedStringLookup.cs
- EntityDataSourceEntitySetNameItem.cs
- DockAndAnchorLayout.cs
- RepeaterCommandEventArgs.cs
- HtmlSelect.cs
- MasterPageCodeDomTreeGenerator.cs
- TraceContextEventArgs.cs
- NonBatchDirectoryCompiler.cs
- DbBuffer.cs
- EncoderNLS.cs
- SiteMembershipCondition.cs
- OuterGlowBitmapEffect.cs
- ColumnMapVisitor.cs
- CachedBitmap.cs
- SchemaInfo.cs
- PolicyChain.cs
- XmlPreloadedResolver.cs
- ClientTarget.cs
- CapabilitiesRule.cs
- ADConnectionHelper.cs
- ColumnResizeUndoUnit.cs
- Attributes.cs
- TreeWalker.cs
- OpacityConverter.cs
- PropertyEntry.cs
- Switch.cs
- PageStatePersister.cs
- WindowsToolbar.cs
- AssemblyResolver.cs
- FloaterBaseParagraph.cs
- ListDictionaryInternal.cs
- nulltextnavigator.cs
- listitem.cs
- WsdlExporter.cs
- DataGridGeneralPage.cs
- AdPostCacheSubstitution.cs
- _ListenerResponseStream.cs
- AttachmentCollection.cs
- DefaultAssemblyResolver.cs
- SqlVersion.cs
- StatusBarAutomationPeer.cs
- ServiceParser.cs
- diagnosticsswitches.cs
- Command.cs
- XdrBuilder.cs
- RenderOptions.cs
- HideDisabledControlAdapter.cs
- DataProtectionSecurityStateEncoder.cs
- SQLGuid.cs
- OdbcException.cs
- ResumeStoryboard.cs
- RadioButtonBaseAdapter.cs
- XmlSchemaSimpleTypeRestriction.cs
- CountAggregationOperator.cs
- ProcessModuleDesigner.cs
- HtmlInputSubmit.cs
- AVElementHelper.cs
- PointLightBase.cs
- Int32AnimationUsingKeyFrames.cs
- ImageUrlEditor.cs
- UserControl.cs
- CopyNodeSetAction.cs
- XPathBinder.cs
- StylusLogic.cs
- WindowsRichEditRange.cs
- LicenseContext.cs
- SubstitutionList.cs
- ConfigurationManager.cs