Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / xsp / System / DynamicData / DynamicData / DynamicQueryStringParameter.cs / 1305376 / DynamicQueryStringParameter.cs
using System.Collections.Generic; using System.Globalization; using System.Web.DynamicData.Util; using System.Web.Resources; using System.Web.UI; using System.Web.UI.WebControls; namespace System.Web.DynamicData { ////// DynamicQueryStringParameter allows a datasource to have its primary key easily fed from the query string. /// It does not require any attributes, and works even for multi-part primary keys. /// public class DynamicQueryStringParameter : Parameter, IWhereParametersProvider { ////// See IWhereParametersProvider.GetWhereParameters /// public virtual IEnumerableGetWhereParameters(IDynamicDataSource dataSource) { var table = MetaTableHelper.GetTableWithFullFallback(dataSource, HttpContext.Current.ToWrapper()); // check makes no sense as the above call will throw //if (table == null) { // return new Parameter[0]; //} return RouteParametersHelper.GetColumnParameters(table, Name); } /// /// same as base /// /// /// ///protected override object Evaluate(HttpContext context, Control control) { // If this gets called, it means we never had a chance to expand the parameter. Give an error // telling the user to use a DynamicDataManager throw new InvalidOperationException(String.Format( CultureInfo.CurrentCulture, DynamicDataResources.DynamicParameter_NeedExpansion, typeof(DynamicQueryStringParameter).Name)); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved. using System.Collections.Generic; using System.Globalization; using System.Web.DynamicData.Util; using System.Web.Resources; using System.Web.UI; using System.Web.UI.WebControls; namespace System.Web.DynamicData { /// /// DynamicQueryStringParameter allows a datasource to have its primary key easily fed from the query string. /// It does not require any attributes, and works even for multi-part primary keys. /// public class DynamicQueryStringParameter : Parameter, IWhereParametersProvider { ////// See IWhereParametersProvider.GetWhereParameters /// public virtual IEnumerableGetWhereParameters(IDynamicDataSource dataSource) { var table = MetaTableHelper.GetTableWithFullFallback(dataSource, HttpContext.Current.ToWrapper()); // check makes no sense as the above call will throw //if (table == null) { // return new Parameter[0]; //} return RouteParametersHelper.GetColumnParameters(table, Name); } /// /// same as base /// /// /// ///protected override object Evaluate(HttpContext context, Control control) { // If this gets called, it means we never had a chance to expand the parameter. Give an error // telling the user to use a DynamicDataManager throw new InvalidOperationException(String.Format( CultureInfo.CurrentCulture, DynamicDataResources.DynamicParameter_NeedExpansion, typeof(DynamicQueryStringParameter).Name)); } } } // 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
- PkcsMisc.cs
- GridViewCellAutomationPeer.cs
- ImageSourceTypeConverter.cs
- GeneralTransform3DTo2DTo3D.cs
- DynamicRendererThreadManager.cs
- TextSpanModifier.cs
- WebControlAdapter.cs
- CodeParameterDeclarationExpressionCollection.cs
- RelationshipEndCollection.cs
- PeerName.cs
- LogAppendAsyncResult.cs
- DotExpr.cs
- ListMarkerSourceInfo.cs
- NumberFunctions.cs
- LazyInitializer.cs
- QilReference.cs
- QuaternionAnimationBase.cs
- WebPartMenu.cs
- JsonObjectDataContract.cs
- Deflater.cs
- AssemblyAttributesGoHere.cs
- Ports.cs
- ExtensibleClassFactory.cs
- SoapProtocolImporter.cs
- DataContractSerializerSection.cs
- milrender.cs
- RenderContext.cs
- LockedActivityGlyph.cs
- mediapermission.cs
- MDIClient.cs
- DataGrid.cs
- SerializationSectionGroup.cs
- TransformValueSerializer.cs
- ParallelForEach.cs
- MergeLocalizationDirectives.cs
- DataGridViewCellStyleConverter.cs
- StylusEditingBehavior.cs
- WebBrowserNavigatedEventHandler.cs
- XmlSerializationGeneratedCode.cs
- InputLanguageEventArgs.cs
- TreeNodeStyle.cs
- UpdateCompiler.cs
- ErrorProvider.cs
- QueryReaderSettings.cs
- AttributeCollection.cs
- ClientSettingsSection.cs
- SettingsSection.cs
- InvalidPrinterException.cs
- ProxyGenerator.cs
- SqlDataAdapter.cs
- InputLanguageEventArgs.cs
- ModifierKeysConverter.cs
- LingerOption.cs
- TemplateKey.cs
- ManagedWndProcTracker.cs
- MaterialCollection.cs
- IgnoreFlushAndCloseStream.cs
- GeometryCombineModeValidation.cs
- ConfigurationManagerHelper.cs
- Underline.cs
- PartialList.cs
- AuthenticationModulesSection.cs
- ToolBarButton.cs
- HostDesigntimeLicenseContext.cs
- DotExpr.cs
- RSAPKCS1KeyExchangeFormatter.cs
- HttpApplicationFactory.cs
- TreeNodeCollection.cs
- DisplayInformation.cs
- util.cs
- RuntimeHandles.cs
- DynamicValueConverter.cs
- SubclassTypeValidator.cs
- EntityDataSourceUtil.cs
- ClientEventManager.cs
- Point3DIndependentAnimationStorage.cs
- BmpBitmapDecoder.cs
- TypeBuilder.cs
- FocusChangedEventArgs.cs
- ConfigXmlComment.cs
- FocusManager.cs
- XPathPatternBuilder.cs
- compensatingcollection.cs
- MethodRental.cs
- CodeDelegateInvokeExpression.cs
- ColorIndependentAnimationStorage.cs
- ClientProxyGenerator.cs
- MasterPageBuildProvider.cs
- SqlVersion.cs
- basenumberconverter.cs
- Html32TextWriter.cs
- WebExceptionStatus.cs
- MarkupExtensionParser.cs
- AsymmetricKeyExchangeDeformatter.cs
- ProcessProtocolHandler.cs
- ExpandedWrapper.cs
- BackgroundFormatInfo.cs
- RectValueSerializer.cs
- SqlBooleanMismatchVisitor.cs
- LicenseContext.cs