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
- XmlRootAttribute.cs
- TypeConverterValueSerializer.cs
- ReadOnlyDataSource.cs
- RSAPKCS1KeyExchangeFormatter.cs
- MasterPageCodeDomTreeGenerator.cs
- FolderBrowserDialog.cs
- NativeRightsManagementAPIsStructures.cs
- XPathNodeHelper.cs
- EdgeModeValidation.cs
- SecondaryViewProvider.cs
- SiteIdentityPermission.cs
- ItemCollection.cs
- DataMember.cs
- MailWebEventProvider.cs
- InteropTrackingRecord.cs
- Odbc32.cs
- NodeInfo.cs
- BaseParaClient.cs
- TabControlEvent.cs
- dataSvcMapFileLoader.cs
- CssClassPropertyAttribute.cs
- HttpListenerContext.cs
- UniformGrid.cs
- SqlTypesSchemaImporter.cs
- GridViewItemAutomationPeer.cs
- SoundPlayerAction.cs
- InputProcessorProfiles.cs
- XmlNodeChangedEventManager.cs
- VarRefManager.cs
- SmtpTransport.cs
- ToolBar.cs
- LocalizationCodeDomSerializer.cs
- PersonalizationEntry.cs
- QilTypeChecker.cs
- ColumnReorderedEventArgs.cs
- SafeEventLogReadHandle.cs
- XmlHierarchyData.cs
- GiveFeedbackEventArgs.cs
- ManipulationStartedEventArgs.cs
- ServiceObjectContainer.cs
- EmbeddedMailObjectsCollection.cs
- FlowLayoutSettings.cs
- ObjectQueryProvider.cs
- FixedSchema.cs
- DbParameterCollectionHelper.cs
- CultureInfoConverter.cs
- ApplicationException.cs
- sortedlist.cs
- TextServicesProperty.cs
- TextAdaptor.cs
- SQLGuid.cs
- NameValueCache.cs
- WaitHandleCannotBeOpenedException.cs
- ReadContentAsBinaryHelper.cs
- RoleBoolean.cs
- MergePropertyDescriptor.cs
- MruCache.cs
- BypassElement.cs
- GeneralTransform3DGroup.cs
- BrushConverter.cs
- FrameworkContentElement.cs
- FileUpload.cs
- XamlGridLengthSerializer.cs
- ReadOnlyCollectionBase.cs
- ThreadStaticAttribute.cs
- MouseButtonEventArgs.cs
- AsyncResult.cs
- DescendentsWalker.cs
- MULTI_QI.cs
- WpfWebRequestHelper.cs
- SQLBytes.cs
- TheQuery.cs
- XmlNavigatorFilter.cs
- EntityClientCacheEntry.cs
- Window.cs
- TextElementEnumerator.cs
- SimpleWebHandlerParser.cs
- DataGridViewLayoutData.cs
- LoginCancelEventArgs.cs
- ListItemConverter.cs
- ArcSegment.cs
- PropertyManager.cs
- HtmlTable.cs
- TraceHandler.cs
- BamlReader.cs
- ToolStrip.cs
- FontDriver.cs
- PageParser.cs
- SchemaImporterExtensionElement.cs
- FormViewUpdateEventArgs.cs
- PointLightBase.cs
- DataShape.cs
- ColumnClickEvent.cs
- HostingEnvironmentSection.cs
- CacheForPrimitiveTypes.cs
- SR.Designer.cs
- ScalarType.cs
- GlobalizationSection.cs
- AxHost.cs
- TaiwanCalendar.cs