Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / xsp / System / Web / UI / WebControls / ReadOnlyHierarchicalDataSource.cs / 1305376 / ReadOnlyHierarchicalDataSource.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Web.UI.WebControls { using System; using System.Collections; using System.ComponentModel; using System.Web; using System.Web.UI; using System.Web.Util; ////// Helper class for hierarchical data bound controls to wrap an generic /// data source with a strongly typed IHierarchicalDataSource. This class /// automatically handles other IHierarchicalDataSources and /// IHierarchicalEnumerables. This class uses /// ReadOnlyHierarchicalDataSourceView to represent individual views. /// internal sealed class ReadOnlyHierarchicalDataSource : IHierarchicalDataSource { private object _dataSource; public ReadOnlyHierarchicalDataSource(object dataSource) { Debug.Assert(dataSource == null || (dataSource is IHierarchicalEnumerable || dataSource is IHierarchicalDataSource), "Expected dataSource to be either null, an IHierarchicalEnumerable, or an IHierarchicalDataSource."); _dataSource = dataSource; } #region Implementation of IHierarchicalDataSource event EventHandler IHierarchicalDataSource.DataSourceChanged { add { } remove { } } ////// Check for IHierarchicalDataSource and IHierarchicalEnumerable, and /// return an approprite HierarchicalDataSourceView. /// HierarchicalDataSourceView IHierarchicalDataSource.GetHierarchicalView(string viewPath) { // Check first for IHierarchicalDataSource IHierarchicalDataSource ds = _dataSource as IHierarchicalDataSource; if (ds != null) { return ds.GetHierarchicalView(viewPath); } IHierarchicalEnumerable enumerable = _dataSource as IHierarchicalEnumerable; if (enumerable != null && viewPath != null && viewPath.Length != 0) { throw new InvalidOperationException(SR.GetString(SR.ReadOnlyHierarchicalDataSourceView_CantAccessPathInEnumerable)); } return new ReadOnlyHierarchicalDataSourceView(enumerable); } #endregion } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ConfigurationSectionGroupCollection.cs
- Relationship.cs
- ClientRuntimeConfig.cs
- MultipleViewProviderWrapper.cs
- mda.cs
- ServiceEndpointElement.cs
- ContextMenu.cs
- CompiledXpathExpr.cs
- MemberAssignment.cs
- JpegBitmapEncoder.cs
- OdbcRowUpdatingEvent.cs
- FeatureSupport.cs
- StopRoutingHandler.cs
- WebConfigurationHostFileChange.cs
- APCustomTypeDescriptor.cs
- invalidudtexception.cs
- FileDetails.cs
- FlagsAttribute.cs
- GeometryConverter.cs
- Matrix3D.cs
- ConfigurationManagerHelper.cs
- ConfigXmlSignificantWhitespace.cs
- ExpressionVisitor.cs
- PackageStore.cs
- RtfControls.cs
- MouseGestureValueSerializer.cs
- wgx_exports.cs
- LayoutUtils.cs
- AddInServer.cs
- XpsS0ValidatingLoader.cs
- BinaryParser.cs
- WpfPayload.cs
- ProcessHostServerConfig.cs
- CompiledRegexRunnerFactory.cs
- IPAddressCollection.cs
- TraceSource.cs
- SocketException.cs
- Model3DGroup.cs
- SslStream.cs
- SourceFileBuildProvider.cs
- CompositeCollection.cs
- BevelBitmapEffect.cs
- IsolatedStoragePermission.cs
- KeyedCollection.cs
- RotationValidation.cs
- ObjectDataSourceView.cs
- GroupItemAutomationPeer.cs
- FileRecordSequenceHelper.cs
- XmlQueryRuntime.cs
- WorkBatch.cs
- DoubleLink.cs
- AxisAngleRotation3D.cs
- XmlElement.cs
- TextFormatterHost.cs
- AssociationSet.cs
- EdmComplexTypeAttribute.cs
- MsmqOutputSessionChannel.cs
- OptionalMessageQuery.cs
- TreeNodeConverter.cs
- ResourcesChangeInfo.cs
- SyndicationSerializer.cs
- Opcode.cs
- Viewport2DVisual3D.cs
- SqlInternalConnectionTds.cs
- OutputCacheProfileCollection.cs
- DSASignatureDeformatter.cs
- DesignerForm.cs
- BlurEffect.cs
- DropShadowBitmapEffect.cs
- OutputCacheModule.cs
- UrlPath.cs
- ListControlDesigner.cs
- ObjectResult.cs
- SqlRecordBuffer.cs
- IntPtr.cs
- ServerIdentity.cs
- TextBlockAutomationPeer.cs
- ConnectionPoint.cs
- DefaultMemberAttribute.cs
- SqlRowUpdatedEvent.cs
- WindowsFormsSectionHandler.cs
- ReadOnlyHierarchicalDataSourceView.cs
- StylusDownEventArgs.cs
- ReliableInputConnection.cs
- HierarchicalDataBoundControlAdapter.cs
- FlowDocumentScrollViewer.cs
- _SecureChannel.cs
- TimeoutValidationAttribute.cs
- Types.cs
- ChangeProcessor.cs
- SpecialNameAttribute.cs
- FindProgressChangedEventArgs.cs
- ExternalException.cs
- ButtonChrome.cs
- ToggleButtonAutomationPeer.cs
- ToolStrip.cs
- ChangePassword.cs
- BitmapEffectCollection.cs
- CodeObject.cs
- Control.cs