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
- IdentityReference.cs
- PasswordDeriveBytes.cs
- Timer.cs
- FormViewInsertedEventArgs.cs
- XsltQilFactory.cs
- DiagnosticTrace.cs
- ShapingEngine.cs
- AutoCompleteStringCollection.cs
- TripleDESCryptoServiceProvider.cs
- HttpCachePolicy.cs
- PerformanceCounterCategory.cs
- SelectionProcessor.cs
- SecurityTokenProvider.cs
- ItemMap.cs
- DataBindingCollection.cs
- EntityClassGenerator.cs
- PropertyDescriptor.cs
- AssertSection.cs
- PrinterResolution.cs
- CommunicationObjectManager.cs
- If.cs
- CultureSpecificCharacterBufferRange.cs
- ScriptDescriptor.cs
- CompilerGeneratedAttribute.cs
- Component.cs
- MutableAssemblyCacheEntry.cs
- BitmapImage.cs
- securitycriticaldataClass.cs
- LayoutUtils.cs
- EUCJPEncoding.cs
- HighContrastHelper.cs
- SoapAttributeOverrides.cs
- EntitySqlQueryBuilder.cs
- ListViewGroupConverter.cs
- CheckBoxAutomationPeer.cs
- PeoplePickerWrapper.cs
- uribuilder.cs
- RectValueSerializer.cs
- DataGridViewBindingCompleteEventArgs.cs
- OleServicesContext.cs
- DesignTimeTemplateParser.cs
- DefaultAsyncDataDispatcher.cs
- ProfessionalColorTable.cs
- ComponentEvent.cs
- IfAction.cs
- MarkupCompilePass1.cs
- DiscoveryClientProtocol.cs
- TextTrailingWordEllipsis.cs
- WMICapabilities.cs
- Types.cs
- XmlProcessingInstruction.cs
- MenuItem.cs
- OdbcConnection.cs
- WindowsFont.cs
- Completion.cs
- ArgumentDesigner.xaml.cs
- Filter.cs
- WebBrowsableAttribute.cs
- BitStream.cs
- LogReserveAndAppendState.cs
- basecomparevalidator.cs
- ExtenderControl.cs
- PopupRootAutomationPeer.cs
- coordinator.cs
- WebBrowserProgressChangedEventHandler.cs
- ProcessHostServerConfig.cs
- PolygonHotSpot.cs
- TemplatedWizardStep.cs
- CodeConditionStatement.cs
- AssemblyResourceLoader.cs
- NativeMethods.cs
- RegexCompiler.cs
- PageStatePersister.cs
- SqlDataReader.cs
- ControllableStoryboardAction.cs
- PathParser.cs
- MenuItemStyleCollection.cs
- XmlCDATASection.cs
- DocumentPaginator.cs
- XmlSchemaDatatype.cs
- XmlSchemaChoice.cs
- WebPart.cs
- Pen.cs
- ObjectStateFormatter.cs
- SapiInterop.cs
- MappingModelBuildProvider.cs
- DataRelationPropertyDescriptor.cs
- TdsParserSafeHandles.cs
- TCEAdapterGenerator.cs
- DbConnectionHelper.cs
- DataPagerFieldItem.cs
- SynchronizedDispatch.cs
- FilterableAttribute.cs
- Exception.cs
- COM2TypeInfoProcessor.cs
- AssemblyResourceLoader.cs
- PanelStyle.cs
- StyleXamlTreeBuilder.cs
- DbConnectionInternal.cs
- ClientSideQueueItem.cs