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
- externdll.cs
- BCLDebug.cs
- ButtonAutomationPeer.cs
- RSAProtectedConfigurationProvider.cs
- ModelItemImpl.cs
- VirtualizedCellInfoCollection.cs
- RadioButtonFlatAdapter.cs
- PropertyItemInternal.cs
- FormatVersion.cs
- LoginUtil.cs
- MethodBuilder.cs
- ToolTipAutomationPeer.cs
- GradientStopCollection.cs
- SharedConnectionListener.cs
- EntitySqlException.cs
- CodeNamespaceImport.cs
- WebContext.cs
- GlyphingCache.cs
- TableSectionStyle.cs
- SchemaElement.cs
- DefaultValueTypeConverter.cs
- TextLineResult.cs
- EventMappingSettingsCollection.cs
- DesignTimeParseData.cs
- SchemaCollectionCompiler.cs
- ZipIOZip64EndOfCentralDirectoryBlock.cs
- X509Utils.cs
- DefaultShape.cs
- OptionalColumn.cs
- CommandValueSerializer.cs
- Rights.cs
- XmlCodeExporter.cs
- SyntaxCheck.cs
- XmlBinaryReader.cs
- ReliabilityContractAttribute.cs
- AutoGeneratedField.cs
- XMLSyntaxException.cs
- CheckBox.cs
- PeerResolverMode.cs
- Timeline.cs
- StringComparer.cs
- GlyphShapingProperties.cs
- ResourcesBuildProvider.cs
- StubHelpers.cs
- wgx_render.cs
- CacheMemory.cs
- KerberosRequestorSecurityToken.cs
- RootBrowserWindowProxy.cs
- XmlSerializerNamespaces.cs
- Rect3DConverter.cs
- MimePart.cs
- RepeaterItem.cs
- ConfigurationSectionGroup.cs
- XpsImage.cs
- XmlTypeAttribute.cs
- ViewCellSlot.cs
- CodeAttachEventStatement.cs
- PackageStore.cs
- PropertyEmitter.cs
- ParseHttpDate.cs
- SingleTagSectionHandler.cs
- TraceSection.cs
- SerialPort.cs
- PropertyChangeTracker.cs
- DataBinding.cs
- SqlUserDefinedAggregateAttribute.cs
- GridViewAutoFormat.cs
- DocumentXPathNavigator.cs
- ListSourceHelper.cs
- RenderingEventArgs.cs
- AndCondition.cs
- PeerTransportSecurityElement.cs
- AlphabetConverter.cs
- WindowProviderWrapper.cs
- SlotInfo.cs
- WindowsStatusBar.cs
- codemethodreferenceexpression.cs
- RegularExpressionValidator.cs
- Menu.cs
- ExpressionBinding.cs
- WebDisplayNameAttribute.cs
- RelatedEnd.cs
- WebSysDefaultValueAttribute.cs
- ProjectionRewriter.cs
- ExpressionStringBuilder.cs
- JsonCollectionDataContract.cs
- TabletDevice.cs
- UnmanagedMarshal.cs
- HWStack.cs
- MobilePage.cs
- PanelStyle.cs
- FileReader.cs
- TemplateBindingExpression.cs
- HtmlTableCellCollection.cs
- ParseChildrenAsPropertiesAttribute.cs
- WebPartPersonalization.cs
- SingleStorage.cs
- SqlRowUpdatedEvent.cs
- DelegateHelpers.Generated.cs
- WebBrowserDesigner.cs