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
- RotationValidation.cs
- SymmetricKeyWrap.cs
- XmlElementAttributes.cs
- TimeEnumHelper.cs
- BufferedMessageData.cs
- WindowsHyperlink.cs
- DoubleCollectionValueSerializer.cs
- UntypedNullExpression.cs
- DataGridRelationshipRow.cs
- XmlDataContract.cs
- Clock.cs
- XmlAttributeCollection.cs
- BrowserDefinitionCollection.cs
- DataTableCollection.cs
- PeerPresenceInfo.cs
- FixedSchema.cs
- ToolboxItemAttribute.cs
- PrinterUnitConvert.cs
- DesignerAdapterUtil.cs
- DesignerVerbCollection.cs
- HMAC.cs
- AtomPub10ServiceDocumentFormatter.cs
- DesignerView.Commands.cs
- XslTransform.cs
- EntityWithKeyStrategy.cs
- WebEventCodes.cs
- SafeCryptHandles.cs
- ComEventsHelper.cs
- DataControlExtensions.cs
- RawStylusInputCustomData.cs
- TypedReference.cs
- ListItemCollection.cs
- ReaderOutput.cs
- CodeConstructor.cs
- WebPartZoneCollection.cs
- CryptoApi.cs
- RegexRunner.cs
- DistributedTransactionPermission.cs
- PersonalizationProvider.cs
- ToolStripPanel.cs
- Clipboard.cs
- OracleTransaction.cs
- sitestring.cs
- TrustManagerPromptUI.cs
- LoginView.cs
- EnumValAlphaComparer.cs
- XmlILOptimizerVisitor.cs
- ExtensionWindowResizeGrip.cs
- ListViewSortEventArgs.cs
- Compiler.cs
- SerializationAttributes.cs
- PlainXmlSerializer.cs
- DataGridLinkButton.cs
- SmtpTransport.cs
- RouteItem.cs
- Crc32.cs
- GradientStop.cs
- AutomationIdentifier.cs
- lengthconverter.cs
- DataConnectionHelper.cs
- PriorityQueue.cs
- PrintDialog.cs
- Setter.cs
- IpcChannelHelper.cs
- InputLanguageSource.cs
- Avt.cs
- webproxy.cs
- PerfCounterSection.cs
- SemanticValue.cs
- MediaElementAutomationPeer.cs
- OleDbErrorCollection.cs
- SchemaTableColumn.cs
- NodeFunctions.cs
- DoubleLinkList.cs
- SoapReflectionImporter.cs
- FontEmbeddingManager.cs
- FormClosingEvent.cs
- PolyBezierSegmentFigureLogic.cs
- MailHeaderInfo.cs
- LayoutEngine.cs
- DocumentApplication.cs
- WindowsSecurityTokenAuthenticator.cs
- XmlIterators.cs
- OdbcCommandBuilder.cs
- TemplateKey.cs
- WindowsComboBox.cs
- TextDecorationCollection.cs
- DecryptedHeader.cs
- NetworkInterface.cs
- XmlDataDocument.cs
- RepeaterItemCollection.cs
- Expression.cs
- ReaderContextStackData.cs
- LineGeometry.cs
- TreeNodeCollectionEditor.cs
- CommandLibraryHelper.cs
- Activation.cs
- ExpressionDumper.cs
- ImageBrush.cs
- TextEditorLists.cs