Code:
/ 4.0 / 4.0 / untmp / 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(); IEnumerableparameters = 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
- EventItfInfo.cs
- DiscoveryUtility.cs
- MouseOverProperty.cs
- OdbcErrorCollection.cs
- IsolatedStorageFilePermission.cs
- COM2Enum.cs
- HierarchicalDataSourceControl.cs
- OleDbParameterCollection.cs
- WindowsListViewGroup.cs
- BindingManagerDataErrorEventArgs.cs
- Vector3DAnimationUsingKeyFrames.cs
- LogFlushAsyncResult.cs
- Int16KeyFrameCollection.cs
- DrawToolTipEventArgs.cs
- FunctionDescription.cs
- DummyDataSource.cs
- DataColumnSelectionConverter.cs
- XhtmlMobileTextWriter.cs
- SqlStream.cs
- CodeSubDirectory.cs
- ToolboxItemWrapper.cs
- WindowsGrip.cs
- TemplateBindingExtension.cs
- objectresult_tresulttype.cs
- GridLengthConverter.cs
- StreamGeometry.cs
- XmlSchemaFacet.cs
- ComponentResourceManager.cs
- _SSPIWrapper.cs
- SqlVersion.cs
- FixedSOMFixedBlock.cs
- PeerNearMe.cs
- DesignerTransactionCloseEvent.cs
- _ListenerResponseStream.cs
- BaseValidator.cs
- DataGridViewColumnStateChangedEventArgs.cs
- documentsequencetextcontainer.cs
- MultiTouchSystemGestureLogic.cs
- TreeNodeBindingCollection.cs
- XmlArrayItemAttributes.cs
- WorkflowViewElement.cs
- DataGridViewRowConverter.cs
- QuotedStringFormatReader.cs
- TemplatedEditableDesignerRegion.cs
- ReachFixedDocumentSerializer.cs
- HtmlShimManager.cs
- StrongNameUtility.cs
- EmbossBitmapEffect.cs
- Panel.cs
- EnumConverter.cs
- _SSPIWrapper.cs
- PolicyReader.cs
- SafeRightsManagementSessionHandle.cs
- EdmConstants.cs
- OrderByBuilder.cs
- DependencyObjectPropertyDescriptor.cs
- DrawingGroupDrawingContext.cs
- UnsafeNativeMethods.cs
- ParagraphResult.cs
- ModelPropertyDescriptor.cs
- SecurityContext.cs
- ValidationSummary.cs
- ArrangedElement.cs
- CompositionAdorner.cs
- ObjectPropertyMapping.cs
- MinMaxParagraphWidth.cs
- Token.cs
- fixedPageContentExtractor.cs
- ValidationEventArgs.cs
- ParagraphVisual.cs
- ModuleConfigurationInfo.cs
- HttpCapabilitiesEvaluator.cs
- ResponseBodyWriter.cs
- NonPrimarySelectionGlyph.cs
- Queue.cs
- SocketCache.cs
- CreateUserWizard.cs
- ProxyHelper.cs
- DataAccessor.cs
- ShutDownListener.cs
- CompositeControl.cs
- CalloutQueueItem.cs
- TextFindEngine.cs
- TableRowCollection.cs
- FlowDocumentScrollViewerAutomationPeer.cs
- AccessKeyManager.cs
- ColorTransformHelper.cs
- PreviewKeyDownEventArgs.cs
- MetabaseSettingsIis7.cs
- TransformerTypeCollection.cs
- ManagementObjectSearcher.cs
- WmlPhoneCallAdapter.cs
- LicenseContext.cs
- DataGridDesigner.cs
- FlowDocumentPaginator.cs
- WmlSelectionListAdapter.cs
- SerializationFieldInfo.cs
- ResizeGrip.cs
- BitmapDownload.cs
- SafeNativeMethods.cs