Code:
/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / ndp / fx / src / xsp / System / Web / UI / WebControls / RequiredFieldValidator.cs / 1 / RequiredFieldValidator.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- /* */ namespace System.Web.UI.WebControls { using System.ComponentModel; using System.Web; using System.Security.Permissions; using System.Web.Util; ////// [ ToolboxData("<{0}:RequiredFieldValidator runat=\"server\" ErrorMessage=\"RequiredFieldValidator\">{0}:RequiredFieldValidator>") ] [AspNetHostingPermission(SecurityAction.LinkDemand, Level=AspNetHostingPermissionLevel.Minimal)] [AspNetHostingPermission(SecurityAction.InheritanceDemand, Level=AspNetHostingPermissionLevel.Minimal)] 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())); } } }
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- MetadataCollection.cs
- Socket.cs
- AutoResizedEvent.cs
- TouchFrameEventArgs.cs
- MembershipSection.cs
- OutKeywords.cs
- EventBuilder.cs
- DataGridItem.cs
- RepeatBehaviorConverter.cs
- JavaScriptString.cs
- TypeBuilderInstantiation.cs
- HWStack.cs
- AssemblyName.cs
- fixedPageContentExtractor.cs
- VisualState.cs
- WebPartAddingEventArgs.cs
- DocumentEventArgs.cs
- ComponentEditorPage.cs
- ColorConvertedBitmap.cs
- ObjectListSelectEventArgs.cs
- RecipientInfo.cs
- HttpBufferlessInputStream.cs
- DesignTimeData.cs
- XPathMessageFilterElementComparer.cs
- CalculatedColumn.cs
- WrapPanel.cs
- GenericPrincipal.cs
- COM2PropertyBuilderUITypeEditor.cs
- JobDuplex.cs
- ContainerParaClient.cs
- ResourceManager.cs
- CharEnumerator.cs
- DataObjectEventArgs.cs
- SQLDoubleStorage.cs
- RegexBoyerMoore.cs
- ColumnCollection.cs
- GridViewUpdatedEventArgs.cs
- WpfSharedXamlSchemaContext.cs
- IdleTimeoutMonitor.cs
- WindowsImpersonationContext.cs
- DeferredTextReference.cs
- LocalValueEnumerator.cs
- RegexParser.cs
- DataGridViewRowHeaderCell.cs
- OperandQuery.cs
- SHA384CryptoServiceProvider.cs
- CacheOutputQuery.cs
- SynchronizedDispatch.cs
- ViewStateException.cs
- QueryMatcher.cs
- HelpInfo.cs
- ModelUIElement3D.cs
- CombinedGeometry.cs
- Vector.cs
- WhileDesigner.xaml.cs
- TextModifierScope.cs
- HostedHttpContext.cs
- ModuleConfigurationInfo.cs
- SpStreamWrapper.cs
- WrapPanel.cs
- SystemDiagnosticsSection.cs
- ProcessManager.cs
- SingleStorage.cs
- PanelStyle.cs
- ButtonChrome.cs
- AnnotationMap.cs
- ConnectionsZoneAutoFormat.cs
- HuffModule.cs
- QueryPageSettingsEventArgs.cs
- XmlUTF8TextReader.cs
- Parameter.cs
- ThreadInterruptedException.cs
- TableMethodGenerator.cs
- MethodAccessException.cs
- SoundPlayerAction.cs
- DecimalKeyFrameCollection.cs
- ButtonChrome.cs
- HtmlInputSubmit.cs
- Trace.cs
- BidirectionalDictionary.cs
- SpecialNameAttribute.cs
- SinglePhaseEnlistment.cs
- WmlFormAdapter.cs
- TimeManager.cs
- AutomationTextAttribute.cs
- MsmqIntegrationMessagePool.cs
- Int64Storage.cs
- XmlElementCollection.cs
- ValidationErrorEventArgs.cs
- VoiceChangeEventArgs.cs
- Pair.cs
- ClientOptions.cs
- PersonalizationStateInfoCollection.cs
- WebPartConnectionsCloseVerb.cs
- OleDbParameterCollection.cs
- RelatedCurrencyManager.cs
- HashAlgorithm.cs
- DataGridRow.cs
- Decoder.cs
- GroupQuery.cs