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
- UrlAuthorizationModule.cs
- BidPrivateBase.cs
- SqlMethodAttribute.cs
- ObjectViewListener.cs
- coordinator.cs
- SqlDesignerDataSourceView.cs
- DataGridViewComboBoxColumn.cs
- CookielessData.cs
- DataGridCaption.cs
- WindowsAuthenticationEventArgs.cs
- MetadataUtilsSmi.cs
- MessageQueueKey.cs
- ContractComponent.cs
- Point4D.cs
- XmlWellformedWriter.cs
- smtpconnection.cs
- StringBuilder.cs
- ExpressionParser.cs
- ComponentSerializationService.cs
- LingerOption.cs
- NameValuePermission.cs
- XpsS0ValidatingLoader.cs
- CallbackBehaviorAttribute.cs
- MessageAction.cs
- MsmqIntegrationOutputChannel.cs
- FilterException.cs
- TextServicesCompartmentContext.cs
- ExpressionList.cs
- Int32Storage.cs
- SafeWaitHandle.cs
- BuildProvider.cs
- ObjectConverter.cs
- LicenseProviderAttribute.cs
- Encoding.cs
- HttpConfigurationSystem.cs
- WebHttpDispatchOperationSelector.cs
- RtfNavigator.cs
- BitmapEffectInput.cs
- BitSet.cs
- SourceFileBuildProvider.cs
- OleDbTransaction.cs
- DesignerActionItemCollection.cs
- ErrorWrapper.cs
- Deflater.cs
- PrintPreviewGraphics.cs
- EntityViewContainer.cs
- ProjectionPathSegment.cs
- ValidatorCollection.cs
- BindingValueChangedEventArgs.cs
- SafeFileHandle.cs
- ByteAnimation.cs
- XmlSchemaSimpleType.cs
- UdpAnnouncementEndpoint.cs
- ConditionalBranch.cs
- OutputCacheSection.cs
- SqlXmlStorage.cs
- Stream.cs
- CreateUserErrorEventArgs.cs
- NameValueCollection.cs
- WindowCollection.cs
- ManagementInstaller.cs
- OrderToken.cs
- ConnectionStringSettingsCollection.cs
- ParameterCollection.cs
- CurrentChangingEventArgs.cs
- ListItemCollection.cs
- StorageConditionPropertyMapping.cs
- FigureHelper.cs
- ForEachAction.cs
- datacache.cs
- WebBrowser.cs
- EdmRelationshipRoleAttribute.cs
- TextTreeTextNode.cs
- SHA256.cs
- EntitySetRetriever.cs
- Transform3DCollection.cs
- ProjectionPathSegment.cs
- DbConnectionPoolIdentity.cs
- XmlSchemaObjectCollection.cs
- ChannelServices.cs
- ColumnResizeAdorner.cs
- LogicalChannelCollection.cs
- AuthenticationModuleElementCollection.cs
- MgmtConfigurationRecord.cs
- MatrixIndependentAnimationStorage.cs
- EditorBrowsableAttribute.cs
- SpellerError.cs
- DropDownButton.cs
- CreateUserErrorEventArgs.cs
- BitmapEffectGroup.cs
- MachineKeySection.cs
- CurrentChangingEventArgs.cs
- ByteConverter.cs
- TrackingProfileSerializer.cs
- BaseProcessor.cs
- ProgramNode.cs
- WebPartConnectionsConfigureVerb.cs
- GroupDescription.cs
- TableRow.cs
- FragmentQueryKB.cs