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;
///
/// Checks if the value of
/// the associated input control is different from its initial value.
///
[
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 {
///
/// Gets or sets the initial value of the associated input control.
///
[
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;
}
}
///
///
/// 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
- ToolStripDropDownClosedEventArgs.cs
- ExpandCollapsePattern.cs
- XPathDocumentIterator.cs
- MouseActionConverter.cs
- _Events.cs
- Animatable.cs
- DataBinder.cs
- ExpressionBinding.cs
- NumberFunctions.cs
- ApplicationManager.cs
- RightsManagementPermission.cs
- CommandSet.cs
- StringWriter.cs
- ColorContext.cs
- MonthChangedEventArgs.cs
- PkcsUtils.cs
- XmlDesigner.cs
- FileEnumerator.cs
- XmlTextReaderImplHelpers.cs
- FixedTextSelectionProcessor.cs
- WhileDesigner.cs
- CmsInterop.cs
- AddressAccessDeniedException.cs
- ConstantProjectedSlot.cs
- WindowsComboBox.cs
- DataGridViewColumnConverter.cs
- PerformanceCountersElement.cs
- HostUtils.cs
- figurelength.cs
- RoleManagerSection.cs
- TextOnlyOutput.cs
- Ops.cs
- FragmentQueryProcessor.cs
- CalculatedColumn.cs
- SchemaElement.cs
- Utils.cs
- SqlProviderManifest.cs
- SHA512.cs
- PolyBezierSegmentFigureLogic.cs
- COM2ComponentEditor.cs
- SpStreamWrapper.cs
- BrowserTree.cs
- RuntimeCompatibilityAttribute.cs
- ReachUIElementCollectionSerializerAsync.cs
- SerializationException.cs
- XXXInfos.cs
- DataGridHeaderBorder.cs
- SourceFileBuildProvider.cs
- WebPartZone.cs
- TypeCodeDomSerializer.cs
- Reference.cs
- OperationCanceledException.cs
- AuthenticationModulesSection.cs
- DocumentXPathNavigator.cs
- DataKeyArray.cs
- XmlComment.cs
- ExceptionValidationRule.cs
- DependencyPropertyDescriptor.cs
- TextTreeTextElementNode.cs
- AnimationLayer.cs
- DateTimeParse.cs
- CodeAttributeArgument.cs
- SerialErrors.cs
- CheckBox.cs
- ISAPIWorkerRequest.cs
- EntityClassGenerator.cs
- DesignerWebPartChrome.cs
- DeflateEmulationStream.cs
- Scheduling.cs
- IList.cs
- Assembly.cs
- ICspAsymmetricAlgorithm.cs
- Utils.cs
- StreamInfo.cs
- TraceHandler.cs
- ListBoxItemAutomationPeer.cs
- CharStorage.cs
- FixUpCollection.cs
- SerializationUtility.cs
- ExpressionConverter.cs
- cookiecontainer.cs
- DataServices.cs
- ModelFunctionTypeElement.cs
- TemplateGroupCollection.cs
- LocalizationComments.cs
- ButtonField.cs
- DocumentSequence.cs
- SqlCommandSet.cs
- InlineCollection.cs
- OracleString.cs
- TagMapInfo.cs
- ObsoleteAttribute.cs
- FixedSOMLineCollection.cs
- RequestQueryProcessor.cs
- SendContent.cs
- UriWriter.cs
- IdentityNotMappedException.cs
- ImageCodecInfoPrivate.cs
- DocumentPageHost.cs
- PolyLineSegment.cs