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
- StreamResourceInfo.cs
- GenericWebPart.cs
- HttpChannelBindingToken.cs
- __ConsoleStream.cs
- EmptyEnumerable.cs
- ContainerTracking.cs
- ReflectionHelper.cs
- ListView.cs
- TagPrefixCollection.cs
- PointConverter.cs
- DataTableTypeConverter.cs
- ListBoxChrome.cs
- WebHttpElement.cs
- ReadOnlyHierarchicalDataSourceView.cs
- XmlSchemaAny.cs
- ContainerParagraph.cs
- FieldBuilder.cs
- MethodBuilder.cs
- PortCache.cs
- StickyNoteAnnotations.cs
- FocusWithinProperty.cs
- Compilation.cs
- XmlUtil.cs
- SerializeAbsoluteContext.cs
- IResourceProvider.cs
- PagePropertiesChangingEventArgs.cs
- CodeSnippetExpression.cs
- URLMembershipCondition.cs
- MetadataCache.cs
- DateTimeOffset.cs
- Int32KeyFrameCollection.cs
- WorkflowItemsPresenter.cs
- SqlExpressionNullability.cs
- CaseExpr.cs
- PresentationUIStyleResources.cs
- DataRelationPropertyDescriptor.cs
- RepeaterCommandEventArgs.cs
- ProgressBar.cs
- DigitShape.cs
- EntityDataSourceReferenceGroup.cs
- XmlElement.cs
- SynchronizationContext.cs
- EmbeddedMailObject.cs
- TdsEnums.cs
- DocumentApplicationJournalEntry.cs
- Int32RectConverter.cs
- SessionEndingEventArgs.cs
- messageonlyhwndwrapper.cs
- LayoutEvent.cs
- PackageDigitalSignature.cs
- BaseResourcesBuildProvider.cs
- LowerCaseStringConverter.cs
- RequestResizeEvent.cs
- IgnoreFlushAndCloseStream.cs
- LoadGrammarCompletedEventArgs.cs
- EastAsianLunisolarCalendar.cs
- XmlSchemaInfo.cs
- AppDomainFactory.cs
- OutputScope.cs
- FrameSecurityDescriptor.cs
- ToolStripPanelSelectionBehavior.cs
- InvokePattern.cs
- AssemblySettingAttributes.cs
- PiiTraceSource.cs
- CodeTypeConstructor.cs
- BorderGapMaskConverter.cs
- StronglyTypedResourceBuilder.cs
- ProjectionCamera.cs
- AssociatedControlConverter.cs
- Win32.cs
- ViewgenContext.cs
- GeometryHitTestParameters.cs
- WebPartTransformer.cs
- ExpressionEditorAttribute.cs
- SafeArrayTypeMismatchException.cs
- HtmlToClrEventProxy.cs
- AsymmetricKeyExchangeFormatter.cs
- SweepDirectionValidation.cs
- RenameRuleObjectDialog.cs
- DynamicResourceExtension.cs
- DocumentOrderQuery.cs
- File.cs
- EntitySqlQueryState.cs
- BindingWorker.cs
- SqlDataSourceEnumerator.cs
- UpDownBase.cs
- ActivationArguments.cs
- TimeEnumHelper.cs
- InternalSafeNativeMethods.cs
- ModulesEntry.cs
- TableRow.cs
- CommandConverter.cs
- OpCellTreeNode.cs
- ServiceContractViewControl.cs
- followingsibling.cs
- GestureRecognitionResult.cs
- BoolExpressionVisitors.cs
- ZipIOZip64EndOfCentralDirectoryLocatorBlock.cs
- SetterTriggerConditionValueConverter.cs
- StdValidatorsAndConverters.cs