Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / ndp / fx / src / xsp / System / Web / UI / WebControls / ReadOnlyHierarchicalDataSource.cs / 1 / 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 } }
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- TableRow.cs
- ObjectSet.cs
- SystemIPGlobalStatistics.cs
- EventLogPermission.cs
- TextFragmentEngine.cs
- WorkflowPrinting.cs
- SqlStatistics.cs
- Int32.cs
- DataGridLinkButton.cs
- SecurityException.cs
- SqlBinder.cs
- HttpEncoder.cs
- PopupRoot.cs
- NamedPermissionSet.cs
- RequestResizeEvent.cs
- PageAsyncTask.cs
- SectionVisual.cs
- RoleManagerModule.cs
- ArgumentNullException.cs
- SHA512Managed.cs
- ListViewItem.cs
- FixedSOMPageConstructor.cs
- ScriptBehaviorDescriptor.cs
- CodeTypeReferenceCollection.cs
- MsmqBindingMonitor.cs
- HttpModuleAction.cs
- HuffmanTree.cs
- PerspectiveCamera.cs
- WindowShowOrOpenTracker.cs
- Random.cs
- RTLAwareMessageBox.cs
- SettingsContext.cs
- UIElement3DAutomationPeer.cs
- DefaultProxySection.cs
- VariantWrapper.cs
- NavigationEventArgs.cs
- SoundPlayer.cs
- XmlNullResolver.cs
- WorkflowElementDialog.cs
- XPathNodeInfoAtom.cs
- AsymmetricSignatureDeformatter.cs
- Pick.cs
- TextTreeTextElementNode.cs
- SystemGatewayIPAddressInformation.cs
- WebServiceHost.cs
- AnonymousIdentificationSection.cs
- HtmlElementErrorEventArgs.cs
- RowUpdatedEventArgs.cs
- InsufficientExecutionStackException.cs
- ExternalCalls.cs
- SmiGettersStream.cs
- CombinedTcpChannel.cs
- ExecutedRoutedEventArgs.cs
- LiteralControl.cs
- XmlIlVisitor.cs
- CommandBindingCollection.cs
- HostTimeoutsElement.cs
- Directory.cs
- DictionaryContent.cs
- Deserializer.cs
- TrackingStringDictionary.cs
- WebControl.cs
- XmlSchemaGroupRef.cs
- PeerName.cs
- WebPartConnectionsConfigureVerb.cs
- SecurityDocument.cs
- BCryptSafeHandles.cs
- TdsParserStaticMethods.cs
- RijndaelCryptoServiceProvider.cs
- ConvertEvent.cs
- Range.cs
- XmlAggregates.cs
- LocationSectionRecord.cs
- ColumnTypeConverter.cs
- ChangePassword.cs
- DllNotFoundException.cs
- SecurityException.cs
- ServerTooBusyException.cs
- Page.cs
- DuplicateWaitObjectException.cs
- BindingManagerDataErrorEventArgs.cs
- SiteOfOriginPart.cs
- SortFieldComparer.cs
- DbModificationClause.cs
- PersonalizationEntry.cs
- InkCanvasSelectionAdorner.cs
- CompilationPass2Task.cs
- UInt64.cs
- DotExpr.cs
- ProxyElement.cs
- AxisAngleRotation3D.cs
- DataGrid.cs
- ExtendedPropertyCollection.cs
- TimeoutException.cs
- HttpStaticObjectsCollectionWrapper.cs
- TextBoxBase.cs
- MatrixIndependentAnimationStorage.cs
- PbrsForward.cs
- LoginCancelEventArgs.cs
- XmlSchemaDatatype.cs