Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / xsp / System / DynamicData / DynamicData / DynamicRouteExpression.cs / 1305376 / DynamicRouteExpression.cs
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Web.DynamicData.Util;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Diagnostics;
#if ORYX_VNEXT
using Microsoft.Web.Data.UI.WebControls.Expressions;
using Microsoft.Web.Data.UI.WebControls;
#else
using System.Web.UI.WebControls.Expressions;
#endif
namespace System.Web.DynamicData {
///
/// This class is an QueryExtender-based equivalent of DynamicQueryStringParameters.
/// When applied to a data source it will filter the data by the value of a primary key encoded
/// in the requests query string (or potentially routing if complex routes are used). If ColumnName
/// is specified it will retrieve the values
///
public class DynamicRouteExpression : DataSourceExpression {
private PropertyExpression _expression = new PropertyExpression();
///
/// An optional column name that can be used to change the filtering mode (i.e. filter by foreign key instead
/// of primary key).
///
[DefaultValue("")]
public string ColumnName { get; set; }
///
/// See base class.
///
public override void SetContext(Control owner, HttpContext context, IQueryableDataSource dataSource) {
base.SetContext(owner, context, dataSource);
owner.Page.InitComplete += new EventHandler(Page_InitComplete);
}
void Page_InitComplete(object sender, EventArgs e) {
Debug.Assert(DataSource != null);
var table = DataSource.GetMetaTable();
IEnumerable parameters = RouteParametersHelper.GetColumnParameters(table, ColumnName);
parameters.ToList().ForEach(p => _expression.Parameters.Add(p));
}
///
/// See base class.
///
public override IQueryable GetQueryable(IQueryable source) {
return _expression.GetQueryable(source);
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Web.DynamicData.Util;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Diagnostics;
#if ORYX_VNEXT
using Microsoft.Web.Data.UI.WebControls.Expressions;
using Microsoft.Web.Data.UI.WebControls;
#else
using System.Web.UI.WebControls.Expressions;
#endif
namespace System.Web.DynamicData {
///
/// This class is an QueryExtender-based equivalent of DynamicQueryStringParameters.
/// When applied to a data source it will filter the data by the value of a primary key encoded
/// in the requests query string (or potentially routing if complex routes are used). If ColumnName
/// is specified it will retrieve the values
///
public class DynamicRouteExpression : DataSourceExpression {
private PropertyExpression _expression = new PropertyExpression();
///
/// An optional column name that can be used to change the filtering mode (i.e. filter by foreign key instead
/// of primary key).
///
[DefaultValue("")]
public string ColumnName { get; set; }
///
/// See base class.
///
public override void SetContext(Control owner, HttpContext context, IQueryableDataSource dataSource) {
base.SetContext(owner, context, dataSource);
owner.Page.InitComplete += new EventHandler(Page_InitComplete);
}
void Page_InitComplete(object sender, EventArgs e) {
Debug.Assert(DataSource != null);
var table = DataSource.GetMetaTable();
IEnumerable parameters = RouteParametersHelper.GetColumnParameters(table, ColumnName);
parameters.ToList().ForEach(p => _expression.Parameters.Add(p));
}
///
/// See base class.
///
public override IQueryable GetQueryable(IQueryable source) {
return _expression.GetQueryable(source);
}
}
}
// 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
- ImpersonationContext.cs
- AVElementHelper.cs
- SafeFindHandle.cs
- OleCmdHelper.cs
- RootContext.cs
- InvokeHandlers.cs
- ReachVisualSerializer.cs
- BindingParameterCollection.cs
- ButtonField.cs
- XmlAtomErrorReader.cs
- TransactionProtocolConverter.cs
- XsltException.cs
- TreeNodeCollectionEditor.cs
- ClientScriptManagerWrapper.cs
- DataSourceControlBuilder.cs
- UIElementParagraph.cs
- StreamSecurityUpgradeAcceptorAsyncResult.cs
- ToolStripDropDownClosingEventArgs.cs
- IncrementalReadDecoders.cs
- HandlerFactoryCache.cs
- ConfigurationManagerInternalFactory.cs
- Formatter.cs
- InputLanguageManager.cs
- DeploymentExceptionMapper.cs
- EmptyEnumerator.cs
- LayoutTable.cs
- DesignerContextDescriptor.cs
- FormatterServices.cs
- _BasicClient.cs
- UserControl.cs
- Section.cs
- RowCache.cs
- TextElement.cs
- TextRangeSerialization.cs
- ToolstripProfessionalRenderer.cs
- Camera.cs
- TCPClient.cs
- GridViewDeletedEventArgs.cs
- webbrowsersite.cs
- SqlInternalConnectionSmi.cs
- DesignerActionGlyph.cs
- SecurityRequiresReviewAttribute.cs
- RectKeyFrameCollection.cs
- MultipartContentParser.cs
- AppSettingsExpressionBuilder.cs
- AnyAllSearchOperator.cs
- SchemaInfo.cs
- TextDecoration.cs
- TextEditorSpelling.cs
- MessageContractExporter.cs
- ElementsClipboardData.cs
- EntityDataSourceDataSelectionPanel.cs
- EndpointPerformanceCounters.cs
- RtfControlWordInfo.cs
- XhtmlConformanceSection.cs
- SequenceRangeCollection.cs
- Literal.cs
- TrackingProfile.cs
- CompilerGlobalScopeAttribute.cs
- SourceFilter.cs
- DatasetMethodGenerator.cs
- XmlWellformedWriter.cs
- TabControlDesigner.cs
- WindowsScrollBarBits.cs
- HitTestWithPointDrawingContextWalker.cs
- Types.cs
- StringHandle.cs
- ObjectDataSourceSelectingEventArgs.cs
- PerfCounterSection.cs
- HandlerBase.cs
- CollectionChangeEventArgs.cs
- CapabilitiesSection.cs
- Stack.cs
- HybridDictionary.cs
- TextBounds.cs
- StringWriter.cs
- XmlNamespaceMappingCollection.cs
- TransformCollection.cs
- BlurBitmapEffect.cs
- WebPartZone.cs
- ConfigXmlText.cs
- LabelInfo.cs
- XmlILOptimizerVisitor.cs
- Latin1Encoding.cs
- CodeTypeReferenceCollection.cs
- InkPresenter.cs
- IgnoreFlushAndCloseStream.cs
- ToolStripItemEventArgs.cs
- COM2FontConverter.cs
- _NetRes.cs
- CodeDOMProvider.cs
- ServerIdentity.cs
- ActivityTypeDesigner.xaml.cs
- Constants.cs
- ContextMenuService.cs
- Root.cs
- RecordBuilder.cs
- CqlBlock.cs
- GuidelineCollection.cs
- ComponentManagerBroker.cs