Code:
/ FXUpdate3074 / FXUpdate3074 / 1.1 / untmp / whidbey / QFE / 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.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- CreateUserWizardStep.cs
- StreamSecurityUpgradeInitiatorBase.cs
- Transform3D.cs
- NamespaceEmitter.cs
- DocumentViewerHelper.cs
- ConditionalExpression.cs
- RowUpdatedEventArgs.cs
- ServiceNameElement.cs
- Grant.cs
- XmlSchemaCollection.cs
- Soap.cs
- BaseAddressElement.cs
- LabelDesigner.cs
- FrugalMap.cs
- AmbiguousMatchException.cs
- VisualBasicSettingsConverter.cs
- ScriptingProfileServiceSection.cs
- ApplicationManager.cs
- WebSysDescriptionAttribute.cs
- HierarchicalDataSourceDesigner.cs
- NullableFloatSumAggregationOperator.cs
- EnumerableCollectionView.cs
- XmlEncoding.cs
- EntityDescriptor.cs
- CodeTypeParameterCollection.cs
- StreamUpdate.cs
- StrokeCollection.cs
- ProgramNode.cs
- ColumnHeader.cs
- EntityDataSourceConfigureObjectContextPanel.cs
- UnsafeNativeMethods.cs
- BackgroundWorker.cs
- OdbcConnection.cs
- PackagePart.cs
- ClrPerspective.cs
- keycontainerpermission.cs
- MaterialCollection.cs
- unsafenativemethodstextservices.cs
- FixedTextPointer.cs
- Version.cs
- DesignerSelectionListAdapter.cs
- Profiler.cs
- PersonalizationAdministration.cs
- MyContact.cs
- SerialStream.cs
- PowerStatus.cs
- DivideByZeroException.cs
- ReadOnlyDataSource.cs
- PropertyGroupDescription.cs
- TagNameToTypeMapper.cs
- Globals.cs
- PhysicalOps.cs
- Freezable.cs
- DataBinding.cs
- DataBinder.cs
- ExpressionBuilder.cs
- UnsafeNativeMethods.cs
- GcSettings.cs
- Rijndael.cs
- ObjectDataSourceDisposingEventArgs.cs
- MILUtilities.cs
- AsyncDataRequest.cs
- FieldCollectionEditor.cs
- SponsorHelper.cs
- DataGridViewSelectedCellCollection.cs
- EventDriven.cs
- GridEntry.cs
- XmlCountingReader.cs
- XomlCompiler.cs
- PropertyTab.cs
- WebExceptionStatus.cs
- ReceiveMessageContent.cs
- Constraint.cs
- PixelFormatConverter.cs
- TableLayout.cs
- WinFormsUtils.cs
- ToolStripGrip.cs
- BamlRecordWriter.cs
- XmlSchemaValidator.cs
- TaskFileService.cs
- SqlResolver.cs
- ThreadTrace.cs
- WindowsListViewItem.cs
- ButtonRenderer.cs
- ObjectNavigationPropertyMapping.cs
- StringAnimationBase.cs
- WmpBitmapEncoder.cs
- X509Extension.cs
- ToolStripItemClickedEventArgs.cs
- MetafileHeaderWmf.cs
- Hex.cs
- GridItemProviderWrapper.cs
- RayHitTestParameters.cs
- GetPageCompletedEventArgs.cs
- LinqDataSourceInsertEventArgs.cs
- GridViewSortEventArgs.cs
- PolyBezierSegment.cs
- PointLight.cs
- QueryStringParameter.cs
- TabControl.cs