Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / MIT / System / Web / UI / MobileControls / CompareValidator.cs / 1305376 / CompareValidator.cs
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
using System;
using System.Collections;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Globalization;
using System.Drawing;
using System.Web;
using System.Web.UI;
using System.Web.UI.Design.WebControls;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using WebCntrls = System.Web.UI.WebControls;
using System.Security.Permissions;
namespace System.Web.UI.MobileControls
{
/*
* Mobile CompareValidator class.
* The CompareValidator compares the value of the associated input control
* with a constant value or another input control. A data type property
* specifies how the values being compared should be interpreted: strings,
* integers, dates, etc. A comparison operator specifies the nature of the
* comparison; greater than, less than, etc.
*
* Copyright (c) 2000 Microsoft Corporation
*/
///
[
ToolboxData("<{0}:CompareValidator runat=\"server\" ErrorMessage=\"CompareValidator\">{0}:CompareValidator>"),
ToolboxItem("System.Web.UI.Design.WebControlToolboxItem, " + AssemblyRef.SystemDesign)
]
[AspNetHostingPermission(SecurityAction.LinkDemand, Level=AspNetHostingPermissionLevel.Minimal)]
[AspNetHostingPermission(SecurityAction.InheritanceDemand, Level=AspNetHostingPermissionLevel.Minimal)]
[Obsolete("The System.Web.Mobile.dll assembly has been deprecated and should no longer be used. For information about how to develop ASP.NET mobile applications, see http://go.microsoft.com/fwlink/?LinkId=157231.")]
public class CompareValidator : BaseValidator
{
private WebCntrls.CompareValidator _webCompareValidator;
///
protected override WebCntrls.BaseValidator CreateWebValidator()
{
_webCompareValidator = new WebCntrls.CompareValidator();
return _webCompareValidator;
}
////////////////////////////////////////////////////////////////////////
// Mimic the properties exposed in the original CompareValidator.
// The properties are got and set directly from the original CompareValidator.
////////////////////////////////////////////////////////////////////////
///
[
Bindable(false),
DefaultValue(""),
MobileCategory(SR.Category_Behavior),
MobileSysDescription(SR.CompareValidator_ControlToCompare),
TypeConverter(typeof(System.Web.UI.Design.MobileControls.Converters.ValidatedMobileControlConverter))
]
public String ControlToCompare
{
get
{
return _webCompareValidator.ControlToCompare;
}
set
{
_webCompareValidator.ControlToCompare = value;
}
}
///
[
Bindable(false),
DefaultValue(ValidationCompareOperator.Equal),
MobileCategory(SR.Category_Behavior),
MobileSysDescription(SR.CompareValidator_Operator)
]
public ValidationCompareOperator Operator
{
get
{
return _webCompareValidator.Operator;
}
set
{
_webCompareValidator.Operator = value;
}
}
///
[
Bindable(false),
DefaultValue(ValidationDataType.String),
MobileCategory(SR.Category_Behavior),
MobileSysDescription(SR.CompareValidator_Type)
]
public ValidationDataType Type
{
get
{
return _webCompareValidator.Type;
}
set
{
_webCompareValidator.Type = value;
}
}
///
[
Bindable(true),
DefaultValue(""),
MobileCategory(SR.Category_Behavior),
MobileSysDescription(SR.CompareValidator_ValueToCompare)
]
public String ValueToCompare
{
get
{
return _webCompareValidator.ValueToCompare;
}
set
{
_webCompareValidator.ValueToCompare = value;
}
}
///
protected override bool EvaluateIsValid()
{
return EvaluateIsValidInternal();
}
/////////////////////////////////////////////////////////////////////
// Helper function adopted from WebForms CompareValidator
/////////////////////////////////////////////////////////////////////
///
protected override bool ControlPropertiesValid()
{
// Check the control id references
if (ControlToCompare.Length > 0)
{
CheckControlValidationProperty(ControlToCompare, "ControlToCompare");
if (String.Compare(ControlToValidate, ControlToCompare, StringComparison.OrdinalIgnoreCase) == 0)
{
throw new ArgumentException(SR.GetString(
SR.CompareValidator_BadCompareControl, ID, ControlToCompare));
}
}
else
{
// Check Values
if (Operator != ValidationCompareOperator.DataTypeCheck &&
!WebCntrls.BaseCompareValidator.CanConvert(ValueToCompare, Type))
{
throw new ArgumentException(SR.GetString(
SR.Validator_ValueBadType,
ValueToCompare,
"ValueToCompare",
ID,
PropertyConverter.EnumToString(
typeof(ValidationDataType), Type)
));
}
}
return base.ControlPropertiesValid();
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
using System;
using System.Collections;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Globalization;
using System.Drawing;
using System.Web;
using System.Web.UI;
using System.Web.UI.Design.WebControls;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using WebCntrls = System.Web.UI.WebControls;
using System.Security.Permissions;
namespace System.Web.UI.MobileControls
{
/*
* Mobile CompareValidator class.
* The CompareValidator compares the value of the associated input control
* with a constant value or another input control. A data type property
* specifies how the values being compared should be interpreted: strings,
* integers, dates, etc. A comparison operator specifies the nature of the
* comparison; greater than, less than, etc.
*
* Copyright (c) 2000 Microsoft Corporation
*/
///
[
ToolboxData("<{0}:CompareValidator runat=\"server\" ErrorMessage=\"CompareValidator\">{0}:CompareValidator>"),
ToolboxItem("System.Web.UI.Design.WebControlToolboxItem, " + AssemblyRef.SystemDesign)
]
[AspNetHostingPermission(SecurityAction.LinkDemand, Level=AspNetHostingPermissionLevel.Minimal)]
[AspNetHostingPermission(SecurityAction.InheritanceDemand, Level=AspNetHostingPermissionLevel.Minimal)]
[Obsolete("The System.Web.Mobile.dll assembly has been deprecated and should no longer be used. For information about how to develop ASP.NET mobile applications, see http://go.microsoft.com/fwlink/?LinkId=157231.")]
public class CompareValidator : BaseValidator
{
private WebCntrls.CompareValidator _webCompareValidator;
///
protected override WebCntrls.BaseValidator CreateWebValidator()
{
_webCompareValidator = new WebCntrls.CompareValidator();
return _webCompareValidator;
}
////////////////////////////////////////////////////////////////////////
// Mimic the properties exposed in the original CompareValidator.
// The properties are got and set directly from the original CompareValidator.
////////////////////////////////////////////////////////////////////////
///
[
Bindable(false),
DefaultValue(""),
MobileCategory(SR.Category_Behavior),
MobileSysDescription(SR.CompareValidator_ControlToCompare),
TypeConverter(typeof(System.Web.UI.Design.MobileControls.Converters.ValidatedMobileControlConverter))
]
public String ControlToCompare
{
get
{
return _webCompareValidator.ControlToCompare;
}
set
{
_webCompareValidator.ControlToCompare = value;
}
}
///
[
Bindable(false),
DefaultValue(ValidationCompareOperator.Equal),
MobileCategory(SR.Category_Behavior),
MobileSysDescription(SR.CompareValidator_Operator)
]
public ValidationCompareOperator Operator
{
get
{
return _webCompareValidator.Operator;
}
set
{
_webCompareValidator.Operator = value;
}
}
///
[
Bindable(false),
DefaultValue(ValidationDataType.String),
MobileCategory(SR.Category_Behavior),
MobileSysDescription(SR.CompareValidator_Type)
]
public ValidationDataType Type
{
get
{
return _webCompareValidator.Type;
}
set
{
_webCompareValidator.Type = value;
}
}
///
[
Bindable(true),
DefaultValue(""),
MobileCategory(SR.Category_Behavior),
MobileSysDescription(SR.CompareValidator_ValueToCompare)
]
public String ValueToCompare
{
get
{
return _webCompareValidator.ValueToCompare;
}
set
{
_webCompareValidator.ValueToCompare = value;
}
}
///
protected override bool EvaluateIsValid()
{
return EvaluateIsValidInternal();
}
/////////////////////////////////////////////////////////////////////
// Helper function adopted from WebForms CompareValidator
/////////////////////////////////////////////////////////////////////
///
protected override bool ControlPropertiesValid()
{
// Check the control id references
if (ControlToCompare.Length > 0)
{
CheckControlValidationProperty(ControlToCompare, "ControlToCompare");
if (String.Compare(ControlToValidate, ControlToCompare, StringComparison.OrdinalIgnoreCase) == 0)
{
throw new ArgumentException(SR.GetString(
SR.CompareValidator_BadCompareControl, ID, ControlToCompare));
}
}
else
{
// Check Values
if (Operator != ValidationCompareOperator.DataTypeCheck &&
!WebCntrls.BaseCompareValidator.CanConvert(ValueToCompare, Type))
{
throw new ArgumentException(SR.GetString(
SR.Validator_ValueBadType,
ValueToCompare,
"ValueToCompare",
ID,
PropertyConverter.EnumToString(
typeof(ValidationDataType), Type)
));
}
}
return base.ControlPropertiesValid();
}
}
}
// 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
- DataControlCommands.cs
- DragEvent.cs
- WindowsAuthenticationEventArgs.cs
- KnownTypeDataContractResolver.cs
- RadioButtonFlatAdapter.cs
- SqlDataSourceConfigureSelectPanel.cs
- LinkConverter.cs
- Clipboard.cs
- DataDocumentXPathNavigator.cs
- SqlFactory.cs
- OracleParameterCollection.cs
- SqlConnectionStringBuilder.cs
- WebPartChrome.cs
- OptimalTextSource.cs
- NamedObject.cs
- FormViewUpdateEventArgs.cs
- ParseElement.cs
- TextElementEnumerator.cs
- DbProviderSpecificTypePropertyAttribute.cs
- StylusSystemGestureEventArgs.cs
- ApplicationActivator.cs
- ConfigurationElementProperty.cs
- CultureTable.cs
- XPathNavigatorReader.cs
- PrinterSettings.cs
- StructuredTypeEmitter.cs
- ConstraintEnumerator.cs
- XmlValueConverter.cs
- ApplyHostConfigurationBehavior.cs
- DynamicObject.cs
- WebEventCodes.cs
- AnimationLayer.cs
- FormViewUpdatedEventArgs.cs
- ForeignKeyConstraint.cs
- PropertyMetadata.cs
- RequestedSignatureDialog.cs
- BamlResourceDeserializer.cs
- MessageQueuePermissionAttribute.cs
- parserscommon.cs
- Itemizer.cs
- WorkItem.cs
- X509ChainPolicy.cs
- Int32CollectionConverter.cs
- SystemIcmpV4Statistics.cs
- XmlBinaryReader.cs
- ToolbarAUtomationPeer.cs
- ViewgenContext.cs
- SqlUDTStorage.cs
- HTTPNotFoundHandler.cs
- SqlConnectionStringBuilder.cs
- PositiveTimeSpanValidatorAttribute.cs
- AnonymousIdentificationModule.cs
- AttachmentCollection.cs
- FormViewCommandEventArgs.cs
- DesignSurface.cs
- AppModelKnownContentFactory.cs
- ClientSettingsStore.cs
- WriteLine.cs
- ColumnMap.cs
- TextDecoration.cs
- ResourceReferenceExpressionConverter.cs
- DescriptionAttribute.cs
- PriorityRange.cs
- PropertyDescriptorComparer.cs
- TrackBarRenderer.cs
- SerializationInfo.cs
- MemberRelationshipService.cs
- LocalizationComments.cs
- FtpRequestCacheValidator.cs
- FontFamilyConverter.cs
- TransportContext.cs
- PropertyGeneratedEventArgs.cs
- PeerCollaboration.cs
- TogglePattern.cs
- PipelineModuleStepContainer.cs
- SoapAttributeOverrides.cs
- FreezableCollection.cs
- Bidi.cs
- KeyManager.cs
- ReflectPropertyDescriptor.cs
- PtsHelper.cs
- WCFModelStrings.Designer.cs
- FigureParagraph.cs
- OleDbDataAdapter.cs
- StickyNoteAnnotations.cs
- TextServicesLoader.cs
- PauseStoryboard.cs
- XPathBuilder.cs
- AlphabeticalEnumConverter.cs
- AvTraceDetails.cs
- TiffBitmapDecoder.cs
- HtmlLink.cs
- ImageField.cs
- RSACryptoServiceProvider.cs
- WebConfigurationFileMap.cs
- OLEDB_Enum.cs
- PlacementWorkspace.cs
- FormViewUpdateEventArgs.cs
- SqlGenerator.cs
- TailCallAnalyzer.cs