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
- SharedDp.cs
- TemplateFactory.cs
- mediaeventshelper.cs
- IndexerNameAttribute.cs
- LoginNameDesigner.cs
- HostingEnvironmentSection.cs
- MouseGesture.cs
- PrimitiveDataContract.cs
- BrowserCapabilitiesFactoryBase.cs
- ObjectFullSpanRewriter.cs
- UICuesEvent.cs
- StreamWriter.cs
- SerializationInfo.cs
- AsymmetricSignatureDeformatter.cs
- Button.cs
- LinkLabel.cs
- EditorAttributeInfo.cs
- XmlSchemaSet.cs
- IncrementalReadDecoders.cs
- TraceSwitch.cs
- PartialToken.cs
- ResourcePermissionBase.cs
- COM2DataTypeToManagedDataTypeConverter.cs
- OpenFileDialog.cs
- Button.cs
- x509utils.cs
- RuntimeHelpers.cs
- AnnotationMap.cs
- CodeTypeDeclarationCollection.cs
- assemblycache.cs
- EntityViewContainer.cs
- ReadOnlyDataSource.cs
- _UncName.cs
- Command.cs
- ScriptReference.cs
- HwndMouseInputProvider.cs
- ButtonBase.cs
- SingleKeyFrameCollection.cs
- FontInfo.cs
- OutOfMemoryException.cs
- HtmlWindow.cs
- UndoManager.cs
- ZeroOpNode.cs
- ComponentChangedEvent.cs
- HtmlMeta.cs
- Parameter.cs
- EntityTypeEmitter.cs
- DataServiceProviderMethods.cs
- InternalConfigHost.cs
- XmlSecureResolver.cs
- PersonalizationStateInfoCollection.cs
- OrderPreservingMergeHelper.cs
- SQLBytes.cs
- QilFactory.cs
- PermissionSetEnumerator.cs
- COM2IProvidePropertyBuilderHandler.cs
- ClientViaElement.cs
- VectorCollectionValueSerializer.cs
- RandomNumberGenerator.cs
- StringAnimationBase.cs
- JoinTreeSlot.cs
- GeneralTransform3DTo2D.cs
- WebRequestModuleElement.cs
- InputLanguageProfileNotifySink.cs
- WindowsSecurityTokenAuthenticator.cs
- InternalCache.cs
- Cursor.cs
- ScalarOps.cs
- TextClipboardData.cs
- RoleManagerSection.cs
- CallId.cs
- Compilation.cs
- ICollection.cs
- AnnotationHighlightLayer.cs
- ListViewItemSelectionChangedEvent.cs
- Evaluator.cs
- MimeFormatter.cs
- ActivityDesignerAccessibleObject.cs
- OpCodes.cs
- UpDownEvent.cs
- FixedHighlight.cs
- Cursor.cs
- DebugHandleTracker.cs
- SoapBinding.cs
- HttpModuleAction.cs
- MsmqChannelFactoryBase.cs
- ResourceReferenceKeyNotFoundException.cs
- HandlerBase.cs
- XsltConvert.cs
- VerificationException.cs
- UrlPropertyAttribute.cs
- QilValidationVisitor.cs
- SocketAddress.cs
- NameNode.cs
- BaseCAMarshaler.cs
- XmlAttributeAttribute.cs
- DynamicPropertyHolder.cs
- FolderBrowserDialog.cs
- SystemBrushes.cs
- BasePropertyDescriptor.cs