Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / 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())); } } } // 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.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())); } } } // 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
- XmlSchemaAttributeGroupRef.cs
- GacUtil.cs
- CommonProperties.cs
- CallbackDebugElement.cs
- FrameworkContentElementAutomationPeer.cs
- XPathDocumentIterator.cs
- SqlClientPermission.cs
- control.ime.cs
- ChangeBlockUndoRecord.cs
- ParallelSeparator.xaml.cs
- EditorBrowsableAttribute.cs
- SystemMulticastIPAddressInformation.cs
- MenuRendererClassic.cs
- PermissionAttributes.cs
- ScrollProperties.cs
- BoolExpressionVisitors.cs
- GridView.cs
- LineInfo.cs
- ByteArrayHelperWithString.cs
- ResXFileRef.cs
- SessionStateModule.cs
- FrameworkElementFactoryMarkupObject.cs
- COM2EnumConverter.cs
- BufferedGenericXmlSecurityToken.cs
- AspNetSynchronizationContext.cs
- DynamicILGenerator.cs
- Method.cs
- FamilyTypeface.cs
- ErrorTableItemStyle.cs
- HwndSourceKeyboardInputSite.cs
- HeaderLabel.cs
- UnaryNode.cs
- DataGridViewDataErrorEventArgs.cs
- connectionpool.cs
- SqlVisitor.cs
- ManagementBaseObject.cs
- XsltContext.cs
- XmlValueConverter.cs
- BaseCodeDomTreeGenerator.cs
- Bitmap.cs
- ToolboxComponentsCreatedEventArgs.cs
- ResourceReferenceKeyNotFoundException.cs
- BoundField.cs
- ReachFixedDocumentSerializerAsync.cs
- InputLanguage.cs
- SessionEndingEventArgs.cs
- RepeatButton.cs
- XmlAnyElementAttributes.cs
- PolyLineSegmentFigureLogic.cs
- DateTimeOffsetAdapter.cs
- RuntimeEnvironment.cs
- InstanceKeyCompleteException.cs
- EncoderExceptionFallback.cs
- XhtmlBasicPhoneCallAdapter.cs
- ServiceHostFactory.cs
- InvalidComObjectException.cs
- Perspective.cs
- DiagnosticsConfiguration.cs
- ActivationProxy.cs
- WebPartPersonalization.cs
- XmlElementCollection.cs
- RequestResponse.cs
- UiaCoreApi.cs
- ReadOnlyCollectionBase.cs
- StaticExtensionConverter.cs
- SpeechDetectedEventArgs.cs
- ConfigXmlText.cs
- SendMailErrorEventArgs.cs
- URI.cs
- TaskFormBase.cs
- MarkupExtensionReturnTypeAttribute.cs
- MessageHeader.cs
- UserControlParser.cs
- TableLayoutPanel.cs
- TreeViewImageIndexConverter.cs
- Attributes.cs
- BCLDebug.cs
- XmlCharacterData.cs
- BooleanAnimationUsingKeyFrames.cs
- EntityDataSourceDesignerHelper.cs
- SchemaCompiler.cs
- TargetInvocationException.cs
- ZoneButton.cs
- AssemblyInfo.cs
- RedistVersionInfo.cs
- CodeArrayIndexerExpression.cs
- HwndKeyboardInputProvider.cs
- TearOffProxy.cs
- UInt16Converter.cs
- ApplicationException.cs
- CategoryGridEntry.cs
- NameValuePair.cs
- SQLMoneyStorage.cs
- AppSettings.cs
- InstalledFontCollection.cs
- RunWorkerCompletedEventArgs.cs
- GridView.cs
- ClockController.cs
- GraphicsState.cs
- XpsSerializationManagerAsync.cs