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
- AutomationPropertyInfo.cs
- ListBindableAttribute.cs
- MD5.cs
- XmlWrappingWriter.cs
- ClassHandlersStore.cs
- Win32Native.cs
- HostedTransportConfigurationManager.cs
- MetadataCacheItem.cs
- NativeObjectSecurity.cs
- ButtonBase.cs
- ByteConverter.cs
- CompilerState.cs
- TextEditorSpelling.cs
- BindUriHelper.cs
- HttpModulesSection.cs
- RawStylusInputReport.cs
- HttpCachePolicy.cs
- MultiView.cs
- State.cs
- SqlVersion.cs
- Route.cs
- RelationshipEnd.cs
- FindProgressChangedEventArgs.cs
- SessionState.cs
- Timer.cs
- RequestCachePolicy.cs
- SymmetricAlgorithm.cs
- BrowserCapabilitiesCompiler.cs
- SqlClientWrapperSmiStream.cs
- HttpConfigurationSystem.cs
- Int16AnimationBase.cs
- PropertyNames.cs
- ContextToken.cs
- DbParameterCollectionHelper.cs
- SecurityBindingElementImporter.cs
- WebConvert.cs
- HtmlTable.cs
- MsmqProcessProtocolHandler.cs
- Error.cs
- PassportAuthentication.cs
- DbConnectionPoolOptions.cs
- Operators.cs
- BufferAllocator.cs
- ValidatingPropertiesEventArgs.cs
- Internal.cs
- TimeSpanOrInfiniteConverter.cs
- ValueConversionAttribute.cs
- SchemaCollectionCompiler.cs
- DataContext.cs
- OleDbCommand.cs
- safesecurityhelperavalon.cs
- TextSelection.cs
- RedirectionProxy.cs
- HTTPNotFoundHandler.cs
- RootDesignerSerializerAttribute.cs
- TraceFilter.cs
- CollectionViewGroupInternal.cs
- IgnoreFileBuildProvider.cs
- MarkupExtensionParser.cs
- ProxySimple.cs
- CharacterString.cs
- ButtonDesigner.cs
- ArrayElementGridEntry.cs
- DrawingServices.cs
- NonClientArea.cs
- ScriptResourceInfo.cs
- SqlCacheDependencySection.cs
- VisualTreeUtils.cs
- StylusButtonCollection.cs
- UrlMapping.cs
- Control.cs
- DictionaryTraceRecord.cs
- TypeBrowserDialog.cs
- ValidatingCollection.cs
- BooleanToVisibilityConverter.cs
- ReadOnlyHierarchicalDataSource.cs
- ActivityMarkupSerializationProvider.cs
- UInt16.cs
- PathData.cs
- CompilerLocalReference.cs
- EmbeddedMailObject.cs
- SocketAddress.cs
- StylusPointDescription.cs
- CustomError.cs
- DataGridViewImageCell.cs
- XmlCodeExporter.cs
- PropertyGridCommands.cs
- PickDesigner.xaml.cs
- PriorityQueue.cs
- ObjectCloneHelper.cs
- ADMembershipUser.cs
- RecipientIdentity.cs
- TcpWorkerProcess.cs
- DoubleMinMaxAggregationOperator.cs
- InputElement.cs
- ThreadPool.cs
- LinearGradientBrush.cs
- NetworkInterface.cs
- XmlSerializationWriter.cs
- UseLicense.cs