Code:
/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / 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())); } } }
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- QueryCacheEntry.cs
- FlowDocumentPage.cs
- WrapPanel.cs
- TimeSpanValidatorAttribute.cs
- HandlerBase.cs
- DoubleLinkListEnumerator.cs
- FocusChangedEventArgs.cs
- DataColumnMapping.cs
- ControlCollection.cs
- ItemsControl.cs
- WebDisplayNameAttribute.cs
- SafeArchiveContext.cs
- BrowserTree.cs
- WebPageTraceListener.cs
- XsltConvert.cs
- ScriptManager.cs
- SafePEFileHandle.cs
- RedistVersionInfo.cs
- DurableServiceAttribute.cs
- XsdValidatingReader.cs
- QueryResponse.cs
- ExpressionLink.cs
- WriteFileContext.cs
- Binding.cs
- ComplexPropertyEntry.cs
- RunInstallerAttribute.cs
- ClassHandlersStore.cs
- ProtocolsSection.cs
- CreateUserWizard.cs
- SecondaryIndexList.cs
- NavigationProperty.cs
- SectionUpdates.cs
- XmlSchemaNotation.cs
- cache.cs
- XmlMapping.cs
- SQLMembershipProvider.cs
- OleDbTransaction.cs
- CompilerParameters.cs
- DataExpression.cs
- TransactedBatchingElement.cs
- ISAPIRuntime.cs
- ResourceExpression.cs
- HierarchicalDataTemplate.cs
- TextTreeFixupNode.cs
- DataGridViewSortCompareEventArgs.cs
- DataGridItemCollection.cs
- HashAlgorithm.cs
- DataGridPagerStyle.cs
- ThreadExceptionEvent.cs
- BindingWorker.cs
- RoutedUICommand.cs
- ObjectSet.cs
- ActivityBuilderHelper.cs
- PropertyIdentifier.cs
- SqlUserDefinedTypeAttribute.cs
- OracleTransaction.cs
- _NegoStream.cs
- CmsInterop.cs
- XmlToDatasetMap.cs
- RoleGroup.cs
- GenericUI.cs
- BindingExpressionUncommonField.cs
- SmiConnection.cs
- CacheDependency.cs
- ThemeInfoAttribute.cs
- XmlUrlEditor.cs
- VisualStyleInformation.cs
- SpeechSeg.cs
- __TransparentProxy.cs
- XmlParserContext.cs
- WebSysDefaultValueAttribute.cs
- XmlIlVisitor.cs
- MessagePropertyVariants.cs
- InkCollectionBehavior.cs
- ResourceManager.cs
- NamespaceList.cs
- BooleanSwitch.cs
- DataGridSortCommandEventArgs.cs
- CryptographicAttribute.cs
- UrlParameterReader.cs
- ProcessHostServerConfig.cs
- PassportAuthenticationEventArgs.cs
- XmlSchemaInclude.cs
- Typeface.cs
- KeyFrames.cs
- MarkupExtensionSerializer.cs
- PointLightBase.cs
- TransformationRules.cs
- ping.cs
- ListViewItem.cs
- MenuItemAutomationPeer.cs
- PropertyIDSet.cs
- DispatcherProcessingDisabled.cs
- PropertyEntry.cs
- SchemaElementDecl.cs
- CodeMemberEvent.cs
- FullTrustAssembly.cs
- OleDbParameter.cs
- RoleGroupCollection.cs
- Error.cs