Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / xsp / System / Web / UI / WebControls / RouteParameter.cs / 1305376 / RouteParameter.cs
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
namespace System.Web.UI.WebControls {
using System;
using System.ComponentModel;
using System.Data;
using System.Security.Permissions;
using System.Web.Routing;
///
/// Represents a Parameter that gets its value from the application's route data.
///
[
DefaultProperty("RouteKey"),
]
public class RouteParameter : Parameter {
///
/// Creates an instance of the RouteParameter class.
///
public RouteParameter() {
}
///
/// Creates an instance of the RouteParameter class with the specified parameter name and request field.
///
public RouteParameter(string name, string routeKey) : base(name) {
RouteKey = routeKey;
}
///
/// Creates an instance of the routeParameter class with the specified parameter name, database type, and
/// request field.
///
public RouteParameter(string name, DbType dbType, string routeKey)
: base(name, dbType) {
RouteKey = routeKey;
}
///
/// Creates an instance of the RouteParameter class with the specified parameter name, type, and request field.
///
public RouteParameter(string name, TypeCode type, string routeKey) : base(name, type) {
RouteKey = routeKey;
}
///
/// Used to clone a parameter.
///
protected RouteParameter(RouteParameter original) : base(original) {
RouteKey = original.RouteKey;
}
///
/// The name of the route value to get the value from.
///
[
DefaultValue(""),
WebCategory("Parameter"),
WebSysDescription(SR.RouteParameter_RouteKey),
]
public string RouteKey {
get {
object o = ViewState["RouteKey"];
if (o == null)
return String.Empty;
return (string)o;
}
set {
if (RouteKey != value) {
ViewState["RouteKey"] = value;
OnParameterChanged();
}
}
}
///
/// Creates a new RouteParameter that is a copy of this RouteParameter.
///
protected override Parameter Clone() {
return new RouteParameter(this);
}
///
/// Returns the updated value of the parameter.
///
protected internal override object Evaluate(HttpContext context, Control control) {
if (context == null || context.Request == null || control == null) {
return null;
}
RouteData routeData = control.Page.RouteData;
if (routeData == null) {
return null;
}
return routeData.Values[RouteKey];
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
namespace System.Web.UI.WebControls {
using System;
using System.ComponentModel;
using System.Data;
using System.Security.Permissions;
using System.Web.Routing;
///
/// Represents a Parameter that gets its value from the application's route data.
///
[
DefaultProperty("RouteKey"),
]
public class RouteParameter : Parameter {
///
/// Creates an instance of the RouteParameter class.
///
public RouteParameter() {
}
///
/// Creates an instance of the RouteParameter class with the specified parameter name and request field.
///
public RouteParameter(string name, string routeKey) : base(name) {
RouteKey = routeKey;
}
///
/// Creates an instance of the routeParameter class with the specified parameter name, database type, and
/// request field.
///
public RouteParameter(string name, DbType dbType, string routeKey)
: base(name, dbType) {
RouteKey = routeKey;
}
///
/// Creates an instance of the RouteParameter class with the specified parameter name, type, and request field.
///
public RouteParameter(string name, TypeCode type, string routeKey) : base(name, type) {
RouteKey = routeKey;
}
///
/// Used to clone a parameter.
///
protected RouteParameter(RouteParameter original) : base(original) {
RouteKey = original.RouteKey;
}
///
/// The name of the route value to get the value from.
///
[
DefaultValue(""),
WebCategory("Parameter"),
WebSysDescription(SR.RouteParameter_RouteKey),
]
public string RouteKey {
get {
object o = ViewState["RouteKey"];
if (o == null)
return String.Empty;
return (string)o;
}
set {
if (RouteKey != value) {
ViewState["RouteKey"] = value;
OnParameterChanged();
}
}
}
///
/// Creates a new RouteParameter that is a copy of this RouteParameter.
///
protected override Parameter Clone() {
return new RouteParameter(this);
}
///
/// Returns the updated value of the parameter.
///
protected internal override object Evaluate(HttpContext context, Control control) {
if (context == null || context.Request == null || control == null) {
return null;
}
RouteData routeData = control.Page.RouteData;
if (routeData == null) {
return null;
}
return routeData.Values[RouteKey];
}
}
}
// 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
- LicenseContext.cs
- SqlNamer.cs
- SystemIPInterfaceProperties.cs
- QilUnary.cs
- Mapping.cs
- LayoutManager.cs
- _LocalDataStoreMgr.cs
- ListViewItemMouseHoverEvent.cs
- ToolbarAUtomationPeer.cs
- HighContrastHelper.cs
- FlagsAttribute.cs
- RightsController.cs
- PathSegment.cs
- GCHandleCookieTable.cs
- TextParagraphCache.cs
- PrimitiveList.cs
- TextElementAutomationPeer.cs
- Metadata.cs
- ModuleConfigurationInfo.cs
- SqlDependency.cs
- XPathDocumentBuilder.cs
- Merger.cs
- TPLETWProvider.cs
- IdentityManager.cs
- DataObjectCopyingEventArgs.cs
- RemotingServices.cs
- ErrorHandler.cs
- OledbConnectionStringbuilder.cs
- CodeDirectionExpression.cs
- CredentialCache.cs
- PageParserFilter.cs
- ServiceThrottle.cs
- AffineTransform3D.cs
- basenumberconverter.cs
- DataList.cs
- Parameter.cs
- ContentElementAutomationPeer.cs
- MostlySingletonList.cs
- PositiveTimeSpanValidator.cs
- ScaleTransform3D.cs
- GroupQuery.cs
- InternalConfigEventArgs.cs
- CodeCompileUnit.cs
- FastEncoderWindow.cs
- TiffBitmapDecoder.cs
- _NTAuthentication.cs
- Panel.cs
- CultureInfo.cs
- ValidatedMobileControlConverter.cs
- DefaultProxySection.cs
- EventSetterHandlerConverter.cs
- SoapAttributes.cs
- FixedDocumentPaginator.cs
- DataObject.cs
- _AutoWebProxyScriptWrapper.cs
- GACIdentityPermission.cs
- DesignerTransaction.cs
- LogReserveAndAppendState.cs
- FillErrorEventArgs.cs
- CategoryAttribute.cs
- MexServiceChannelBuilder.cs
- COM2DataTypeToManagedDataTypeConverter.cs
- PropertyGridView.cs
- DataColumnCollection.cs
- PenLineCapValidation.cs
- TextRunProperties.cs
- TableSectionStyle.cs
- WindowsGraphics2.cs
- ChannelFactory.cs
- QilSortKey.cs
- NonValidatingSecurityTokenAuthenticator.cs
- FloaterParagraph.cs
- XmlReaderSettings.cs
- JpegBitmapDecoder.cs
- XmlSchemaAnnotation.cs
- XmlSerializationWriter.cs
- ParseHttpDate.cs
- SqlDataAdapter.cs
- TTSEvent.cs
- CqlErrorHelper.cs
- ColorConvertedBitmap.cs
- ConfigurationCollectionAttribute.cs
- counter.cs
- XmlSchemaException.cs
- KnownColorTable.cs
- ResourceFallbackManager.cs
- AsyncDataRequest.cs
- BitmapMetadata.cs
- GridViewUpdateEventArgs.cs
- SqlDataRecord.cs
- ServicePoint.cs
- CommonGetThemePartSize.cs
- NavigatorInput.cs
- DependencyPropertyHelper.cs
- PackUriHelper.cs
- TextServicesHost.cs
- XmlTextReaderImpl.cs
- MethodAccessException.cs
- TypeElement.cs
- SessionPageStateSection.cs