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
- RadialGradientBrush.cs
- RoutedEventArgs.cs
- TabControlCancelEvent.cs
- BevelBitmapEffect.cs
- AssemblyBuilder.cs
- smtpconnection.cs
- SHA256.cs
- UniqueCodeIdentifierScope.cs
- RefreshEventArgs.cs
- ControlPager.cs
- ElementUtil.cs
- ClrProviderManifest.cs
- TraceLevelStore.cs
- SafeNativeMethods.cs
- SerializableAttribute.cs
- ReaderWriterLock.cs
- XmlToDatasetMap.cs
- ListBox.cs
- PersonalizationState.cs
- HierarchicalDataSourceControl.cs
- StylusButton.cs
- LayoutEvent.cs
- ElementsClipboardData.cs
- DynamicValidatorEventArgs.cs
- QilInvokeLateBound.cs
- SystemIcmpV6Statistics.cs
- AppDomainAttributes.cs
- NativeObjectSecurity.cs
- GPPOINT.cs
- AtomMaterializer.cs
- XMLSchema.cs
- KeyEvent.cs
- ApplicationSecurityInfo.cs
- ADConnectionHelper.cs
- FunctionQuery.cs
- DefaultSerializationProviderAttribute.cs
- AutoFocusStyle.xaml.cs
- ExpandableObjectConverter.cs
- IndependentAnimationStorage.cs
- InvocationExpression.cs
- EntitySqlQueryCacheEntry.cs
- IconEditor.cs
- HMACSHA256.cs
- ReturnValue.cs
- ResXBuildProvider.cs
- FontCacheLogic.cs
- PerspectiveCamera.cs
- dataSvcMapFileLoader.cs
- MemoryRecordBuffer.cs
- assertwrapper.cs
- Utilities.cs
- AttachmentService.cs
- Point3DCollectionValueSerializer.cs
- SafeWaitHandle.cs
- BufferedGraphicsManager.cs
- PolyBezierSegmentFigureLogic.cs
- NameValueSectionHandler.cs
- Profiler.cs
- DataGridViewCellMouseEventArgs.cs
- XmlElementList.cs
- OleTxTransactionInfo.cs
- WebPartConnectVerb.cs
- PageStatePersister.cs
- DatatypeImplementation.cs
- DefaultBindingPropertyAttribute.cs
- PagedDataSource.cs
- CanonicalXml.cs
- CommonXSendMessage.cs
- IndexerNameAttribute.cs
- SqlTypesSchemaImporter.cs
- WebBrowser.cs
- XmlObjectSerializerReadContext.cs
- SessionStateSection.cs
- _UncName.cs
- DefaultValueTypeConverter.cs
- RijndaelManagedTransform.cs
- UxThemeWrapper.cs
- QilLiteral.cs
- ActionItem.cs
- DbParameterCollection.cs
- InvalidFilterCriteriaException.cs
- ResourceProviderFactory.cs
- Environment.cs
- DataControlLinkButton.cs
- DllNotFoundException.cs
- ContainerTracking.cs
- ControlDesigner.cs
- XamlGridLengthSerializer.cs
- AudioDeviceOut.cs
- NativeMethods.cs
- Win32Exception.cs
- FunctionUpdateCommand.cs
- SqlParameterCollection.cs
- Permission.cs
- SetStateEventArgs.cs
- MetadataPropertyAttribute.cs
- WebRequestModulesSection.cs
- HyperLinkColumn.cs
- Debugger.cs
- httpapplicationstate.cs