Code:
/ DotNET / DotNET / 8.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
- BeginEvent.cs
- TypeListConverter.cs
- EdmComplexPropertyAttribute.cs
- SynchronizedInputPattern.cs
- StorageTypeMapping.cs
- SqlConnectionStringBuilder.cs
- DBDataPermission.cs
- BroadcastEventHelper.cs
- SqlProviderManifest.cs
- IItemContainerGenerator.cs
- SmiEventSink_DeferedProcessing.cs
- HttpModuleCollection.cs
- TokenBasedSetEnumerator.cs
- OracleConnectionFactory.cs
- CodeTypeReferenceCollection.cs
- NativeMethodsCLR.cs
- DictionaryItemsCollection.cs
- ClientProxyGenerator.cs
- TimeSpanStorage.cs
- UIElementHelper.cs
- Size.cs
- CookieParameter.cs
- SHA1Managed.cs
- GridErrorDlg.cs
- DaylightTime.cs
- PickDesigner.xaml.cs
- CookieParameter.cs
- DateTimeParse.cs
- SrgsElementList.cs
- DebugController.cs
- SafeThreadHandle.cs
- BitmapEffectDrawingContextWalker.cs
- UnknownBitmapDecoder.cs
- UIAgentInitializationException.cs
- XmlWrappingReader.cs
- SemanticAnalyzer.cs
- MSAAEventDispatcher.cs
- ToolStripRenderer.cs
- DataServices.cs
- StatusBar.cs
- CryptoKeySecurity.cs
- TargetControlTypeCache.cs
- Control.cs
- SerialReceived.cs
- WindowsFormsDesignerOptionService.cs
- DataGridViewBand.cs
- GlyphInfoList.cs
- URI.cs
- ItemContainerGenerator.cs
- DataObject.cs
- ReflectTypeDescriptionProvider.cs
- CodeStatement.cs
- TableCell.cs
- DBConcurrencyException.cs
- SymDocumentType.cs
- HttpPostedFile.cs
- IMembershipProvider.cs
- LambdaCompiler.Binary.cs
- FileDetails.cs
- MaterialCollection.cs
- SqlDataSourceEnumerator.cs
- CompilerGeneratedAttribute.cs
- XmlBinaryReader.cs
- ObjectSpanRewriter.cs
- DocumentPageTextView.cs
- mediaeventargs.cs
- _SingleItemRequestCache.cs
- EastAsianLunisolarCalendar.cs
- ProfilePropertySettingsCollection.cs
- GenerateHelper.cs
- HttpResponseHeader.cs
- GeneralTransformGroup.cs
- securitycriticaldataClass.cs
- Walker.cs
- SessionParameter.cs
- X509RawDataKeyIdentifierClause.cs
- EventLogTraceListener.cs
- FontSource.cs
- SafeNativeMethodsOther.cs
- ModelFactory.cs
- BaseValidator.cs
- InternalConfigRoot.cs
- TemplatedWizardStep.cs
- Path.cs
- DtdParser.cs
- DocumentStatusResources.cs
- AttributeTable.cs
- FilterException.cs
- EnumConverter.cs
- DbConnectionFactory.cs
- XmlValueConverter.cs
- XmlEnumAttribute.cs
- WindowsScrollBarBits.cs
- XmlUtf8RawTextWriter.cs
- MimeBasePart.cs
- ProbeDuplexCD1AsyncResult.cs
- TypeDependencyAttribute.cs
- TextServicesManager.cs
- KeyFrames.cs
- StrongNameIdentityPermission.cs