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
- SafeCryptHandles.cs
- EncoderParameter.cs
- DataGridToolTip.cs
- RichTextBoxContextMenu.cs
- XmlNodeReader.cs
- ProbeMatchesCD1.cs
- DataBoundLiteralControl.cs
- XmlNodeReader.cs
- AssociationTypeEmitter.cs
- BoundsDrawingContextWalker.cs
- QueryContinueDragEvent.cs
- SecurityStandardsManager.cs
- RoleManagerEventArgs.cs
- ScriptingScriptResourceHandlerSection.cs
- BehaviorService.cs
- XmlCharacterData.cs
- ObjectDataSourceDisposingEventArgs.cs
- LinearGradientBrush.cs
- SeekStoryboard.cs
- ZoneButton.cs
- ServiceBehaviorAttribute.cs
- Guid.cs
- ArraySegment.cs
- CodeSpit.cs
- Int32Rect.cs
- SafeHGlobalHandleCritical.cs
- ConnectionProviderAttribute.cs
- CLSCompliantAttribute.cs
- AttachedPropertyBrowsableForChildrenAttribute.cs
- _OverlappedAsyncResult.cs
- RegionData.cs
- PropertyInformationCollection.cs
- DataColumnPropertyDescriptor.cs
- CombinedTcpChannel.cs
- ObjectQueryProvider.cs
- oledbconnectionstring.cs
- SizeLimitedCache.cs
- BamlLocalizerErrorNotifyEventArgs.cs
- AssociationEndMember.cs
- ButtonChrome.cs
- CopyNodeSetAction.cs
- DataBoundControlHelper.cs
- DesignTimeTemplateParser.cs
- MultipleCopiesCollection.cs
- WhitespaceRuleReader.cs
- DataGridColumnHeaderAutomationPeer.cs
- Debug.cs
- securitymgrsite.cs
- UriTemplateQueryValue.cs
- HttpPostedFile.cs
- XmlSerializationReader.cs
- HierarchicalDataSourceConverter.cs
- JsonWriter.cs
- SqlPersistenceProviderFactory.cs
- XmlSchemaSequence.cs
- RangeValueProviderWrapper.cs
- AuthenticationServiceManager.cs
- BoundField.cs
- DelayedRegex.cs
- WindowsRichEdit.cs
- MethodExpr.cs
- RangeValuePatternIdentifiers.cs
- CompressStream.cs
- AbsoluteQuery.cs
- CopyCodeAction.cs
- InfoCardSymmetricCrypto.cs
- RuntimeConfigLKG.cs
- SynchronizationContext.cs
- ExtractedStateEntry.cs
- XmlStreamNodeWriter.cs
- WebHttpElement.cs
- LockCookie.cs
- TextBox.cs
- TypeLibConverter.cs
- FieldAccessException.cs
- recordstatescratchpad.cs
- XPathAncestorQuery.cs
- FormsAuthentication.cs
- InheritanceAttribute.cs
- HWStack.cs
- Cursors.cs
- TableRowCollection.cs
- ValuePatternIdentifiers.cs
- PropertyChangedEventManager.cs
- ObjectListCommandEventArgs.cs
- TextAction.cs
- MediaTimeline.cs
- NavigationEventArgs.cs
- WorkItem.cs
- DependencyPropertyValueSerializer.cs
- ProviderException.cs
- StreamReader.cs
- SafeWaitHandle.cs
- CancelEventArgs.cs
- KeyValuePair.cs
- BookmarkInfo.cs
- AsymmetricKeyExchangeFormatter.cs
- _SpnDictionary.cs
- WorkflowMarkupSerializationProvider.cs
- Evaluator.cs