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
- UnsafeNativeMethods.cs
- HwndSubclass.cs
- WebPartConnectionsConfigureVerb.cs
- ContextQuery.cs
- TextChangedEventArgs.cs
- SecurityDescriptor.cs
- SQLBytes.cs
- Win32SafeHandles.cs
- CustomCredentialPolicy.cs
- CqlLexerHelpers.cs
- AtomParser.cs
- DataGridViewComboBoxEditingControl.cs
- EventLogPermissionEntryCollection.cs
- FormCollection.cs
- WebPartChrome.cs
- CodeMemberMethod.cs
- TreeNodeBindingCollection.cs
- IndexedString.cs
- ApplicationException.cs
- mansign.cs
- Exceptions.cs
- PrivilegedConfigurationManager.cs
- WpfGeneratedKnownTypes.cs
- XPathArrayIterator.cs
- Token.cs
- X509Chain.cs
- TextPenaltyModule.cs
- EntityDataSourceContextCreatingEventArgs.cs
- GeometryGroup.cs
- BuilderPropertyEntry.cs
- SchemaEntity.cs
- SQlBooleanStorage.cs
- AttachedProperty.cs
- DiscoveryInnerClientAdhocCD1.cs
- FrameworkContentElement.cs
- ChainOfDependencies.cs
- FileLoadException.cs
- SQLInt64.cs
- HashSetEqualityComparer.cs
- CheckPair.cs
- PackageRelationshipCollection.cs
- HttpPostClientProtocol.cs
- CompositeDataBoundControl.cs
- DoubleCollectionValueSerializer.cs
- CheckBoxDesigner.cs
- ModuleElement.cs
- LongCountAggregationOperator.cs
- GlyphRunDrawing.cs
- FreezableCollection.cs
- UserPreferenceChangedEventArgs.cs
- ConfigXmlAttribute.cs
- ListViewInsertedEventArgs.cs
- StandardOleMarshalObject.cs
- BitmapImage.cs
- SoapSchemaMember.cs
- TrimSurroundingWhitespaceAttribute.cs
- HashCryptoHandle.cs
- BindingElementExtensionElement.cs
- FunctionImportElement.cs
- Component.cs
- SkipStoryboardToFill.cs
- XsdDateTime.cs
- WebPageTraceListener.cs
- ExtendedPropertyCollection.cs
- SizeConverter.cs
- TripleDESCryptoServiceProvider.cs
- Thickness.cs
- EntityParameter.cs
- metadatamappinghashervisitor.cs
- DataTableMappingCollection.cs
- ColumnBinding.cs
- StorageMappingItemCollection.cs
- ListBox.cs
- PnrpPeerResolverBindingElement.cs
- RectValueSerializer.cs
- TextRunCacheImp.cs
- SerialStream.cs
- MinMaxParagraphWidth.cs
- EarlyBoundInfo.cs
- Delegate.cs
- DataTableExtensions.cs
- Object.cs
- MultiplexingFormatMapping.cs
- LogStore.cs
- DependencyPropertyHelper.cs
- Int32AnimationUsingKeyFrames.cs
- TreeNode.cs
- SynchronizingStream.cs
- Byte.cs
- DPCustomTypeDescriptor.cs
- ReachFixedPageSerializerAsync.cs
- TracePayload.cs
- TagPrefixCollection.cs
- FixedLineResult.cs
- HtmlInputButton.cs
- ImageListStreamer.cs
- VirtualPathUtility.cs
- EntityCollection.cs
- ValueHandle.cs
- DataGrid.cs