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
- TimeoutException.cs
- HttpVersion.cs
- CodeSubDirectory.cs
- ClientRuntime.cs
- BitmapInitialize.cs
- GraphicsContainer.cs
- DiscoveryDocumentSearchPattern.cs
- DownloadProgressEventArgs.cs
- DashStyles.cs
- PeerNameRecordCollection.cs
- WebPartZone.cs
- TranslateTransform3D.cs
- SchemaImporterExtension.cs
- LinkButton.cs
- IOException.cs
- ILGen.cs
- CreateUserErrorEventArgs.cs
- LogLogRecordHeader.cs
- ViewEvent.cs
- LinearKeyFrames.cs
- PathFigureCollectionValueSerializer.cs
- ObjectIDGenerator.cs
- SkipStoryboardToFill.cs
- SafeProcessHandle.cs
- PageHandlerFactory.cs
- Trace.cs
- CalendarDataBindingHandler.cs
- PerformanceCounterCategory.cs
- SmtpFailedRecipientException.cs
- BooleanAnimationUsingKeyFrames.cs
- ImageList.cs
- IPAddressCollection.cs
- MouseActionValueSerializer.cs
- TargetInvocationException.cs
- SmiMetaDataProperty.cs
- TabletDeviceInfo.cs
- MessageBox.cs
- ProfileService.cs
- DocumentViewerBaseAutomationPeer.cs
- wmiprovider.cs
- FormatStringEditor.cs
- WSHttpBindingBaseElement.cs
- CacheSection.cs
- ContentElementAutomationPeer.cs
- DocumentEventArgs.cs
- DependencySource.cs
- XmlDataImplementation.cs
- XmlnsPrefixAttribute.cs
- ToolStripTemplateNode.cs
- SizeChangedEventArgs.cs
- ProfileSettings.cs
- SafeNativeMethodsCLR.cs
- FontSourceCollection.cs
- WindowsListView.cs
- StatusStrip.cs
- IPAddressCollection.cs
- AttachedProperty.cs
- ParameterCollection.cs
- OperationCanceledException.cs
- MultilineStringConverter.cs
- invalidudtexception.cs
- OverrideMode.cs
- CodeCatchClauseCollection.cs
- JavaScriptString.cs
- NetworkAddressChange.cs
- WebWorkflowRole.cs
- LexicalChunk.cs
- ProgressBarBrushConverter.cs
- StorageBasedPackageProperties.cs
- LostFocusEventManager.cs
- RectAnimationUsingKeyFrames.cs
- HtmlGenericControl.cs
- AttributedMetaModel.cs
- uribuilder.cs
- XmlArrayItemAttributes.cs
- basecomparevalidator.cs
- ProgramNode.cs
- SolidBrush.cs
- EngineSite.cs
- TextComposition.cs
- LOSFormatter.cs
- __TransparentProxy.cs
- ProcessThreadCollection.cs
- PolyBezierSegment.cs
- cookiecollection.cs
- XmlHierarchicalDataSourceView.cs
- CodeComment.cs
- TextTreeFixupNode.cs
- SmtpAuthenticationManager.cs
- ProcessHostMapPath.cs
- DescendantQuery.cs
- NameTable.cs
- OutputCacheProfile.cs
- DataGridTablesFactory.cs
- StreamUpdate.cs
- TitleStyle.cs
- CodeConstructor.cs
- xmlglyphRunInfo.cs
- PageThemeBuildProvider.cs
- OperationContractAttribute.cs