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(); 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. 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
- EntityDataSourceEntityTypeFilterConverter.cs
- LogicalChannel.cs
- RowSpanVector.cs
- PageScaling.cs
- TypeBuilderInstantiation.cs
- InlineUIContainer.cs
- Exceptions.cs
- IntPtr.cs
- Renderer.cs
- ProgressBarAutomationPeer.cs
- TimelineGroup.cs
- SID.cs
- PagesChangedEventArgs.cs
- Literal.cs
- WhitespaceRuleReader.cs
- FileBasedResourceGroveler.cs
- SetIterators.cs
- SqlUserDefinedTypeAttribute.cs
- ClientTargetSection.cs
- CroppedBitmap.cs
- FontConverter.cs
- ChannelFactoryRefCache.cs
- BaseCollection.cs
- TransactionContext.cs
- DockEditor.cs
- InvalidAsynchronousStateException.cs
- ErrorWrapper.cs
- SizeLimitedCache.cs
- AccessibleObject.cs
- PageBreakRecord.cs
- WebPartConnectionsCloseVerb.cs
- EntityDataSourceMemberPath.cs
- ToolStripSplitStackLayout.cs
- PropertyReferenceSerializer.cs
- ToolStripLocationCancelEventArgs.cs
- PlanCompilerUtil.cs
- VerticalAlignConverter.cs
- HttpMethodAttribute.cs
- Normalization.cs
- PageSetupDialog.cs
- PreviewPrintController.cs
- NetworkCredential.cs
- PropertyFilterAttribute.cs
- _PooledStream.cs
- QueryCoreOp.cs
- MobileControlsSection.cs
- BookmarkUndoUnit.cs
- StoryFragments.cs
- WebPartTransformerAttribute.cs
- Block.cs
- MailMessage.cs
- EdmType.cs
- FormViewDeletedEventArgs.cs
- Reference.cs
- UInt64.cs
- EntityUtil.cs
- FigureParaClient.cs
- ObjectStateEntry.cs
- LookupNode.cs
- InputScopeNameConverter.cs
- Size.cs
- FirstMatchCodeGroup.cs
- SafeHandles.cs
- TypeBuilderInstantiation.cs
- Interfaces.cs
- SQLMoney.cs
- NamespaceCollection.cs
- ToggleButtonAutomationPeer.cs
- DataPager.cs
- EncoderReplacementFallback.cs
- InputElement.cs
- ToolStripArrowRenderEventArgs.cs
- ThemeableAttribute.cs
- MaskDescriptor.cs
- TCPListener.cs
- DataPointer.cs
- SoapProtocolImporter.cs
- Operand.cs
- HttpsHostedTransportConfiguration.cs
- ReachDocumentReferenceSerializer.cs
- TextBoxAutomationPeer.cs
- WsiProfilesElementCollection.cs
- UrlPath.cs
- HttpCookie.cs
- SqlRecordBuffer.cs
- Control.cs
- PageContentCollection.cs
- AutomationIdentifier.cs
- BitArray.cs
- NotifyCollectionChangedEventArgs.cs
- MetafileHeaderWmf.cs
- OutputCacheProfileCollection.cs
- _SslStream.cs
- Constants.cs
- TextDecorationUnitValidation.cs
- ValidationErrorEventArgs.cs
- TaiwanLunisolarCalendar.cs
- ChannelToken.cs
- KeyInfo.cs
- XmlWrappingWriter.cs