Code:
/ FXUpdate3074 / FXUpdate3074 / 1.1 / untmp / 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.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- WebPartAuthorizationEventArgs.cs
- Transform3D.cs
- WindowsSolidBrush.cs
- LocalizableAttribute.cs
- WebPartTransformerAttribute.cs
- WhitespaceRuleReader.cs
- CommandPlan.cs
- ToolStripPanelRenderEventArgs.cs
- TextBoxDesigner.cs
- Helpers.cs
- DisplayNameAttribute.cs
- Property.cs
- XsltContext.cs
- MsmqIntegrationAppDomainProtocolHandler.cs
- FontUnit.cs
- CorrelationHandle.cs
- TypeSystem.cs
- WriteStateInfoBase.cs
- TransactionFlowAttribute.cs
- QilTargetType.cs
- TextTrailingCharacterEllipsis.cs
- CharacterMetricsDictionary.cs
- SuppressIldasmAttribute.cs
- SchemaManager.cs
- MarkupExtensionReturnTypeAttribute.cs
- CompressEmulationStream.cs
- LocatorGroup.cs
- Model3D.cs
- LoadWorkflowByKeyAsyncResult.cs
- WebBrowserNavigatingEventHandler.cs
- XmlAnyElementAttributes.cs
- XPathItem.cs
- Thread.cs
- InvariantComparer.cs
- mansign.cs
- HScrollProperties.cs
- ListChangedEventArgs.cs
- OutputCacheSettings.cs
- Stroke.cs
- RoleServiceManager.cs
- DesignerSerializerAttribute.cs
- DataComponentGenerator.cs
- RsaSecurityKey.cs
- StructuralComparisons.cs
- CacheAxisQuery.cs
- StringSource.cs
- DataTableClearEvent.cs
- SoapCodeExporter.cs
- ExtensionMethods.cs
- SqlUtils.cs
- MediaContextNotificationWindow.cs
- BlobPersonalizationState.cs
- XmlNullResolver.cs
- GridViewAutomationPeer.cs
- LayoutManager.cs
- ComponentCollection.cs
- ToolStripSystemRenderer.cs
- TimestampInformation.cs
- PerformanceCounterLib.cs
- Operators.cs
- ControlCollection.cs
- DesignerVerbCollection.cs
- SettingsProperty.cs
- Version.cs
- EncryptedXml.cs
- SqlDataSourceFilteringEventArgs.cs
- RemoteWebConfigurationHost.cs
- InternalSafeNativeMethods.cs
- CodeTypeDeclaration.cs
- EventPropertyMap.cs
- AssociationEndMember.cs
- ZipIOExtraFieldElement.cs
- TextRenderer.cs
- DataPagerFieldItem.cs
- NotificationContext.cs
- ColorMap.cs
- TableItemPattern.cs
- ExpandCollapseProviderWrapper.cs
- SoapElementAttribute.cs
- ColumnResizeAdorner.cs
- WebServicesInteroperability.cs
- RelationshipType.cs
- ComponentEditorPage.cs
- Substitution.cs
- Stroke2.cs
- MasterPageBuildProvider.cs
- ListControl.cs
- FunctionParameter.cs
- PageCodeDomTreeGenerator.cs
- LockingPersistenceProvider.cs
- ConvertEvent.cs
- EmptyStringExpandableObjectConverter.cs
- DispatchOperationRuntime.cs
- RawStylusActions.cs
- AnonymousIdentificationSection.cs
- JsonGlobals.cs
- ThemeableAttribute.cs
- TextAutomationPeer.cs
- ModuleElement.cs
- RemoteWebConfigurationHostServer.cs