Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / 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
- CodeCastExpression.cs
- InternalControlCollection.cs
- DependencyPropertyKind.cs
- SiblingIterators.cs
- QuerySetOp.cs
- FamilyTypeface.cs
- ExecutedRoutedEventArgs.cs
- ImplicitInputBrush.cs
- ConnectionManagementSection.cs
- AttachedPropertyBrowsableWhenAttributePresentAttribute.cs
- XsdCachingReader.cs
- EntityExpressionVisitor.cs
- HybridDictionary.cs
- CodeChecksumPragma.cs
- AssemblyInfo.cs
- NativeMethods.cs
- CodeSubDirectoriesCollection.cs
- FieldDescriptor.cs
- Point3DConverter.cs
- MultiTargetingUtil.cs
- DataGridViewLinkColumn.cs
- Brushes.cs
- TranslateTransform.cs
- WindowsListViewItemCheckBox.cs
- GZipDecoder.cs
- BoundingRectTracker.cs
- FlowNode.cs
- SqlProcedureAttribute.cs
- PhysicalOps.cs
- PostBackOptions.cs
- CqlIdentifiers.cs
- PropertyInfoSet.cs
- SQLBytes.cs
- BinaryFormatter.cs
- ToolStripInSituService.cs
- TraceHelpers.cs
- IIS7UserPrincipal.cs
- ComboBoxAutomationPeer.cs
- StaticResourceExtension.cs
- AdornerLayer.cs
- FixedSchema.cs
- TraceData.cs
- DocumentOrderComparer.cs
- DataObjectAttribute.cs
- ToolStripStatusLabel.cs
- XmlSchemaSubstitutionGroup.cs
- DupHandleConnectionReader.cs
- PhysicalOps.cs
- ServicePoint.cs
- EntityViewContainer.cs
- COSERVERINFO.cs
- SoapEnumAttribute.cs
- ContextMenuAutomationPeer.cs
- DesignerAdapterAttribute.cs
- GlyphElement.cs
- StaticTextPointer.cs
- WizardSideBarListControlItem.cs
- XmlNavigatorStack.cs
- wgx_sdk_version.cs
- ProfilePropertyMetadata.cs
- MdiWindowListStrip.cs
- RemoteWebConfigurationHost.cs
- Point3D.cs
- DataGridCell.cs
- CodeCommentStatementCollection.cs
- ReadContentAsBinaryHelper.cs
- Lease.cs
- TextElement.cs
- ReadOnlyObservableCollection.cs
- Binding.cs
- EditorBrowsableAttribute.cs
- ImageSource.cs
- HandledMouseEvent.cs
- ManipulationCompletedEventArgs.cs
- SoapTypeAttribute.cs
- RequestDescription.cs
- UnsafeNetInfoNativeMethods.cs
- SqlInternalConnectionTds.cs
- OdbcParameterCollection.cs
- MetaModel.cs
- InputManager.cs
- SamlAuthenticationClaimResource.cs
- _MultipleConnectAsync.cs
- SspiHelper.cs
- MouseCaptureWithinProperty.cs
- Rotation3D.cs
- TypefaceMetricsCache.cs
- HWStack.cs
- FileAuthorizationModule.cs
- ColorComboBox.cs
- ChtmlMobileTextWriter.cs
- XamlToRtfParser.cs
- HtmlLabelAdapter.cs
- CompletedAsyncResult.cs
- OleAutBinder.cs
- Shape.cs
- SessionEndingCancelEventArgs.cs
- CorePropertiesFilter.cs
- TableChangeProcessor.cs
- ChangeBlockUndoRecord.cs