Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / xsp / System / Web / UI / WebControls / RequiredFieldValidator.cs / 1305376 / RequiredFieldValidator.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- /* */ namespace System.Web.UI.WebControls { using System.ComponentModel; using System.Web; using System.Web.Util; ////// [ ToolboxData("<{0}:RequiredFieldValidator runat=\"server\" ErrorMessage=\"RequiredFieldValidator\">{0}:RequiredFieldValidator>") ] 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
- ProgressBar.cs
- MembershipUser.cs
- TypefaceMap.cs
- webeventbuffer.cs
- CompressedStack.cs
- AccessKeyManager.cs
- JoinQueryOperator.cs
- BaseDataBoundControl.cs
- XPathSelectionIterator.cs
- CalendarButton.cs
- TraceHelpers.cs
- EventLogEntry.cs
- XmlQualifiedName.cs
- ServiceHostFactory.cs
- SmiConnection.cs
- DocumentOrderQuery.cs
- EventlogProvider.cs
- CrossSiteScriptingValidation.cs
- FilterElement.cs
- LicenseContext.cs
- ConfigurationSectionCollection.cs
- CorrelationRequestContext.cs
- ConversionContext.cs
- Expressions.cs
- CommonDialog.cs
- BasePattern.cs
- WsdlEndpointConversionContext.cs
- FormViewDeleteEventArgs.cs
- PersonalizationProviderCollection.cs
- CustomSignedXml.cs
- FontUnit.cs
- ObjectFactoryCodeDomTreeGenerator.cs
- AmbientValueAttribute.cs
- SecurityState.cs
- ObjectListFieldCollection.cs
- ElementInit.cs
- serverconfig.cs
- ScriptingAuthenticationServiceSection.cs
- ToolStripContainer.cs
- ImageKeyConverter.cs
- SamlNameIdentifierClaimResource.cs
- OSEnvironmentHelper.cs
- ResXFileRef.cs
- Path.cs
- HttpContext.cs
- HwndTarget.cs
- Native.cs
- StreamUpdate.cs
- NumberSubstitution.cs
- BitmapEffectRenderDataResource.cs
- TextMetrics.cs
- OleDbException.cs
- OdbcErrorCollection.cs
- embossbitmapeffect.cs
- SqlMethodTransformer.cs
- _ListenerRequestStream.cs
- FlowDocumentPageViewerAutomationPeer.cs
- FileIOPermission.cs
- KeyedHashAlgorithm.cs
- NullReferenceException.cs
- IISMapPath.cs
- Receive.cs
- login.cs
- MultiBindingExpression.cs
- IRCollection.cs
- LineServicesRun.cs
- ScriptComponentDescriptor.cs
- InternalPermissions.cs
- SoundPlayer.cs
- ConfigUtil.cs
- SettingsPropertyCollection.cs
- LabelTarget.cs
- ReadContentAsBinaryHelper.cs
- ScriptResourceAttribute.cs
- DebugTraceHelper.cs
- xamlnodes.cs
- GifBitmapEncoder.cs
- ParameterEditorUserControl.cs
- CallContext.cs
- WebPartUtil.cs
- TextSyndicationContentKindHelper.cs
- precedingsibling.cs
- DataGridViewImageColumn.cs
- FileClassifier.cs
- NetworkStream.cs
- SynchronizedRandom.cs
- MetricEntry.cs
- Process.cs
- BooleanAnimationBase.cs
- SafeFileMapViewHandle.cs
- DesignerVerbCollection.cs
- DataGridColumnReorderingEventArgs.cs
- DEREncoding.cs
- Matrix3D.cs
- VersionUtil.cs
- SecurityIdentifierConverter.cs
- WS2007FederationHttpBinding.cs
- SpeechSynthesizer.cs
- EntitySetBaseCollection.cs
- ChannelCacheDefaults.cs