Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / 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
- FormViewPageEventArgs.cs
- DbConnectionStringCommon.cs
- NativeMethods.cs
- ConfigurationCollectionAttribute.cs
- SqlMetaData.cs
- StringValidatorAttribute.cs
- __ComObject.cs
- EntityDataSourceWrapperCollection.cs
- DataGridBoundColumn.cs
- RoleManagerSection.cs
- UniqueEventHelper.cs
- AnchoredBlock.cs
- Model3D.cs
- SqlRemoveConstantOrderBy.cs
- SingleConverter.cs
- DataControlPagerLinkButton.cs
- Material.cs
- Label.cs
- CodeMemberMethod.cs
- SpeakProgressEventArgs.cs
- PublisherIdentityPermission.cs
- ExecutionContext.cs
- ExpressionBinding.cs
- QuarticEase.cs
- XpsException.cs
- FileAuthorizationModule.cs
- ValidationErrorCollection.cs
- Style.cs
- InternalTypeHelper.cs
- TextCharacters.cs
- httpapplicationstate.cs
- SystemUnicastIPAddressInformation.cs
- StringPropertyBuilder.cs
- DbgUtil.cs
- ParameterElementCollection.cs
- keycontainerpermission.cs
- Base64Decoder.cs
- ObjectDataSourceStatusEventArgs.cs
- PolicyManager.cs
- HttpGetClientProtocol.cs
- OleAutBinder.cs
- DesignerActionListCollection.cs
- TextPointer.cs
- ToolStripItemCollection.cs
- PagerStyle.cs
- ReferenceTypeElement.cs
- MemoryPressure.cs
- OleDbTransaction.cs
- SecurityManager.cs
- TypeUsageBuilder.cs
- FontStyleConverter.cs
- TypeUsageBuilder.cs
- WebBrowserDocumentCompletedEventHandler.cs
- DataListItemEventArgs.cs
- WebPartZoneBase.cs
- RoutedUICommand.cs
- DataTableNewRowEvent.cs
- AudioStateChangedEventArgs.cs
- ConfigurationValues.cs
- TextAnchor.cs
- Point3DAnimationUsingKeyFrames.cs
- TemplateBaseAction.cs
- _NtlmClient.cs
- Bezier.cs
- DataGridViewAutoSizeColumnsModeEventArgs.cs
- TextEditorMouse.cs
- WindowsFont.cs
- ListViewSelectEventArgs.cs
- PointLight.cs
- ChangeBlockUndoRecord.cs
- EndpointAddressElementBase.cs
- AssemblyHelper.cs
- MappingException.cs
- EnumConverter.cs
- SignedPkcs7.cs
- ZipIORawDataFileBlock.cs
- OutgoingWebRequestContext.cs
- DeleteHelper.cs
- WindowsIdentity.cs
- LogWriteRestartAreaState.cs
- UInt16.cs
- SmtpReplyReader.cs
- ResXBuildProvider.cs
- UIElementAutomationPeer.cs
- PropertyPath.cs
- EraserBehavior.cs
- WhitespaceRuleLookup.cs
- Point4D.cs
- DetailsViewCommandEventArgs.cs
- Misc.cs
- SafeHandles.cs
- ToolStripContentPanel.cs
- ValidatorUtils.cs
- ServiceModelSecurityTokenRequirement.cs
- SessionSwitchEventArgs.cs
- ExpressionPrefixAttribute.cs
- FloaterBaseParaClient.cs
- XpsFilter.cs
- GridErrorDlg.cs
- WindowsHyperlink.cs