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
- SourceSwitch.cs
- indexingfiltermarshaler.cs
- Cursor.cs
- RuleRefElement.cs
- Cursor.cs
- ValuePatternIdentifiers.cs
- metrodevice.cs
- Rotation3DAnimationUsingKeyFrames.cs
- ProfileSettings.cs
- EventPrivateKey.cs
- ErrorHandler.cs
- ToolTipService.cs
- DataGridItemEventArgs.cs
- TableItemPatternIdentifiers.cs
- ContextConfiguration.cs
- OLEDB_Enum.cs
- InternalSafeNativeMethods.cs
- OLEDB_Util.cs
- _WebProxyDataBuilder.cs
- ping.cs
- SQLUtility.cs
- RequestTimeoutManager.cs
- FocusChangedEventArgs.cs
- AllMembershipCondition.cs
- EntryIndex.cs
- ColorAnimation.cs
- NamedPipeHostedTransportConfiguration.cs
- ToolboxItemImageConverter.cs
- LineSegment.cs
- EditorAttribute.cs
- RadioButton.cs
- BitVec.cs
- DataSourceConverter.cs
- CommandPlan.cs
- TextEditorCharacters.cs
- WinEventTracker.cs
- ScaleTransform3D.cs
- TabControl.cs
- ContentPropertyAttribute.cs
- ArgumentNullException.cs
- DrawListViewColumnHeaderEventArgs.cs
- Int16Storage.cs
- NativeMethods.cs
- XhtmlConformanceSection.cs
- PartitionResolver.cs
- XmlDocumentType.cs
- HttpWebRequest.cs
- Bookmark.cs
- TempFiles.cs
- WeakEventTable.cs
- MyContact.cs
- EventSchemaTraceListener.cs
- LocalBuilder.cs
- ActivationServices.cs
- DoubleStorage.cs
- MdiWindowListStrip.cs
- SqlClientFactory.cs
- NegotiationTokenAuthenticator.cs
- FormViewInsertedEventArgs.cs
- ViewBase.cs
- HierarchicalDataSourceConverter.cs
- WindowsSpinner.cs
- _ListenerResponseStream.cs
- TypePresenter.xaml.cs
- Parser.cs
- TextBoxRenderer.cs
- FactoryRecord.cs
- CompositeActivityTypeDescriptorProvider.cs
- FixedSOMFixedBlock.cs
- PolygonHotSpot.cs
- CssStyleCollection.cs
- PixelFormatConverter.cs
- ToolStripOverflowButton.cs
- HandleCollector.cs
- WindowsFont.cs
- XpsViewerException.cs
- WorkItem.cs
- SchemaContext.cs
- ClientConfigurationSystem.cs
- SafeRegistryKey.cs
- ChineseLunisolarCalendar.cs
- CatalogZone.cs
- DataViewSetting.cs
- XmlLanguage.cs
- CodeCompiler.cs
- hwndwrapper.cs
- Listbox.cs
- ColorBlend.cs
- LayoutInformation.cs
- DispatchWrapper.cs
- SplitterCancelEvent.cs
- DataServiceRequestException.cs
- IndicShape.cs
- ManagedIStream.cs
- DbTypeMap.cs
- UserPersonalizationStateInfo.cs
- StatusCommandUI.cs
- FactoryRecord.cs
- StylusPointPropertyId.cs
- AttributeAction.cs