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
- DataMember.cs
- GlyphingCache.cs
- ReadOnlyTernaryTree.cs
- ExtentJoinTreeNode.cs
- CopyAttributesAction.cs
- RowSpanVector.cs
- ConfigXmlComment.cs
- VarInfo.cs
- DataSpaceManager.cs
- ObjectTypeMapping.cs
- ComponentEvent.cs
- EventLogEntryCollection.cs
- OdbcEnvironment.cs
- QueryOutputWriter.cs
- TraceXPathNavigator.cs
- ErrorWebPart.cs
- ComMethodElementCollection.cs
- TextChange.cs
- RoleService.cs
- CookieHandler.cs
- CellConstantDomain.cs
- ChtmlTextWriter.cs
- PieceDirectory.cs
- DrawingContextDrawingContextWalker.cs
- TextSimpleMarkerProperties.cs
- NetworkInterface.cs
- Style.cs
- ComponentManagerBroker.cs
- CreateParams.cs
- ObjectStateManager.cs
- LinqDataSourceValidationException.cs
- FileSystemEventArgs.cs
- DotNetATv1WindowsLogEntryDeserializer.cs
- SchemaCreator.cs
- DesignBindingConverter.cs
- Classification.cs
- WmlCalendarAdapter.cs
- JpegBitmapDecoder.cs
- RangeBase.cs
- DataServiceEntityAttribute.cs
- XmlCustomFormatter.cs
- EmbeddedMailObjectsCollection.cs
- SafeHandle.cs
- BuildManager.cs
- EqualityArray.cs
- AddIn.cs
- ModuleBuilderData.cs
- TextDecoration.cs
- DbConnectionStringCommon.cs
- MonthCalendarDesigner.cs
- WebPartEditorCancelVerb.cs
- IdnMapping.cs
- PeerOutputChannel.cs
- PartialCachingControl.cs
- ScrollViewerAutomationPeer.cs
- WorkflowPersistenceService.cs
- DataGridViewSortCompareEventArgs.cs
- Span.cs
- COM2ColorConverter.cs
- DataSourceControlBuilder.cs
- Track.cs
- BindableTemplateBuilder.cs
- InfoCardRSAOAEPKeyExchangeDeformatter.cs
- ExceptionUtil.cs
- BindingCompleteEventArgs.cs
- RenderDataDrawingContext.cs
- WindowsUpDown.cs
- WrappedIUnknown.cs
- GridItemProviderWrapper.cs
- XmlAttributes.cs
- WaitHandle.cs
- Fonts.cs
- DataControlFieldHeaderCell.cs
- CultureData.cs
- ControlTemplate.cs
- Hashtable.cs
- NextPreviousPagerField.cs
- TextEditorCharacters.cs
- XmlDataSourceView.cs
- CaseInsensitiveHashCodeProvider.cs
- WebWorkflowRole.cs
- ProfileModule.cs
- ReflectPropertyDescriptor.cs
- SchemaCollectionCompiler.cs
- Attribute.cs
- ButtonField.cs
- LogConverter.cs
- DBPropSet.cs
- ErrorInfoXmlDocument.cs
- XsltQilFactory.cs
- _SafeNetHandles.cs
- NativeActivity.cs
- NotImplementedException.cs
- PlainXmlSerializer.cs
- QueryReaderSettings.cs
- FamilyCollection.cs
- DesignerActionUIService.cs
- Point.cs
- ViewBox.cs
- SendKeys.cs