Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / xsp / System / Web / UI / WebControls / RequiredFieldValidator.cs / 1305376 / RequiredFieldValidator.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- /* */ namespace System.Web.UI.WebControls { using System.ComponentModel; using System.Web; using System.Web.Util; ////// [ ToolboxData("<{0}:RequiredFieldValidator runat=\"server\" ErrorMessage=\"RequiredFieldValidator\">{0}:RequiredFieldValidator>") ] 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.Web.Util; ////// [ ToolboxData("<{0}:RequiredFieldValidator runat=\"server\" ErrorMessage=\"RequiredFieldValidator\">{0}:RequiredFieldValidator>") ] 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
- WindowsTokenRoleProvider.cs
- OutputCacheSection.cs
- HierarchicalDataBoundControl.cs
- HGlobalSafeHandle.cs
- CodeTypeMember.cs
- StorageComplexPropertyMapping.cs
- NamedPermissionSet.cs
- InputLangChangeRequestEvent.cs
- RequestCachePolicyConverter.cs
- UIPropertyMetadata.cs
- DynamicActivity.cs
- XPathArrayIterator.cs
- DocumentSchemaValidator.cs
- TypeTypeConverter.cs
- ProcessHostConfigUtils.cs
- Action.cs
- SqlRecordBuffer.cs
- CorrelationManager.cs
- DataGridColumnHeadersPresenter.cs
- VirtualPathProvider.cs
- DispatcherEventArgs.cs
- HtmlButton.cs
- ReferencedAssembly.cs
- PeerUnsafeNativeMethods.cs
- EventHandlerList.cs
- KeyValueConfigurationCollection.cs
- ColorPalette.cs
- RewritingValidator.cs
- CommandValueSerializer.cs
- ColorConvertedBitmap.cs
- SqlDataSourceView.cs
- MdiWindowListStrip.cs
- RSAProtectedConfigurationProvider.cs
- QuaternionKeyFrameCollection.cs
- CodeLinePragma.cs
- PageVisual.cs
- IFlowDocumentViewer.cs
- DeviceContext2.cs
- AlternateView.cs
- ErrorTableItemStyle.cs
- ContextProperty.cs
- Int64Storage.cs
- TagPrefixAttribute.cs
- Size3DConverter.cs
- _BasicClient.cs
- EmbeddedObject.cs
- ArrayWithOffset.cs
- ValueChangedEventManager.cs
- SrgsOneOf.cs
- ProcessStartInfo.cs
- SqlPersonalizationProvider.cs
- DecimalConverter.cs
- OrderingExpression.cs
- ZoneIdentityPermission.cs
- CodeGen.cs
- WebPartRestoreVerb.cs
- InfoCardXmlSerializer.cs
- SchemaCollectionCompiler.cs
- BasicCommandTreeVisitor.cs
- HexParser.cs
- ObjectFactoryCodeDomTreeGenerator.cs
- PackageProperties.cs
- DataGridViewLinkCell.cs
- DeflateInput.cs
- CompilerState.cs
- AppSecurityManager.cs
- ViewCellRelation.cs
- TdsParser.cs
- DataObjectMethodAttribute.cs
- PageSetupDialog.cs
- EmptyQuery.cs
- ButtonBaseAutomationPeer.cs
- XPathNodeIterator.cs
- TitleStyle.cs
- ProgressiveCrcCalculatingStream.cs
- Evidence.cs
- SynchronizedInputHelper.cs
- SQLInt32.cs
- FileVersionInfo.cs
- InvokeBase.cs
- DetailsViewDeletedEventArgs.cs
- Span.cs
- UrlPath.cs
- Triangle.cs
- AsyncPostBackErrorEventArgs.cs
- TypeInfo.cs
- Function.cs
- AttachmentService.cs
- ZipIOLocalFileDataDescriptor.cs
- AddingNewEventArgs.cs
- TransformGroup.cs
- SymLanguageVendor.cs
- Pair.cs
- OrderedEnumerableRowCollection.cs
- XmlQualifiedName.cs
- columnmapkeybuilder.cs
- PropVariant.cs
- ProfileProvider.cs
- KeyValuePair.cs
- KeyValuePairs.cs