Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / 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 } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ //// 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
![Network programming in C#, Network Programming in VB.NET, Network Programming in .NET](/images/book.jpg)
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- SchemaMapping.cs
- SpellerHighlightLayer.cs
- TableLayoutPanelCellPosition.cs
- InternalCache.cs
- HyperLinkColumn.cs
- PreProcessor.cs
- codemethodreferenceexpression.cs
- IisTraceListener.cs
- ClosableStream.cs
- StaticFileHandler.cs
- RightNameExpirationInfoPair.cs
- BufferModesCollection.cs
- Point3D.cs
- GridViewColumnCollectionChangedEventArgs.cs
- CodeConstructor.cs
- TryExpression.cs
- DataGridViewRowsAddedEventArgs.cs
- DataBindEngine.cs
- XmlStreamStore.cs
- TPLETWProvider.cs
- LookupNode.cs
- TextBoxBase.cs
- ShapeTypeface.cs
- ToolStripSettings.cs
- EnumUnknown.cs
- ConnectionStringSettingsCollection.cs
- MenuItemStyle.cs
- InputReport.cs
- ArraySortHelper.cs
- sqlpipe.cs
- SqlXml.cs
- SoapServerMethod.cs
- ComponentResourceManager.cs
- SingleTagSectionHandler.cs
- FormViewUpdatedEventArgs.cs
- ObjectDataSourceDisposingEventArgs.cs
- PriorityChain.cs
- OperatingSystem.cs
- DeferredReference.cs
- DynamicControlParameter.cs
- Duration.cs
- TabletCollection.cs
- InstanceValue.cs
- CaseCqlBlock.cs
- EntityDataSourceStatementEditorForm.cs
- BuildProviderCollection.cs
- TransformPatternIdentifiers.cs
- ToolstripProfessionalRenderer.cs
- WindowVisualStateTracker.cs
- StreamInfo.cs
- EntityObject.cs
- TextDecorationCollection.cs
- PinnedBufferMemoryStream.cs
- PropertyEmitterBase.cs
- StatusBar.cs
- SelectorItemAutomationPeer.cs
- XPathNavigatorException.cs
- OnOperation.cs
- SrgsElement.cs
- LocationUpdates.cs
- DataGridViewCellMouseEventArgs.cs
- ScrollBarRenderer.cs
- StackBuilderSink.cs
- AttributeUsageAttribute.cs
- DataControlFieldCollection.cs
- SspiWrapper.cs
- DoubleLink.cs
- AssociatedControlConverter.cs
- EllipticalNodeOperations.cs
- Switch.cs
- XmlQueryType.cs
- SqlClientWrapperSmiStreamChars.cs
- DataRelationPropertyDescriptor.cs
- InputEventArgs.cs
- TdsParserStateObject.cs
- SymbolType.cs
- StringInfo.cs
- FullTrustAssembly.cs
- ListViewCancelEventArgs.cs
- ClientCultureInfo.cs
- Int32CAMarshaler.cs
- Trigger.cs
- SqlGenericUtil.cs
- TimeSpanStorage.cs
- LinkedList.cs
- MouseActionValueSerializer.cs
- XmlHierarchicalEnumerable.cs
- XmlUtil.cs
- CompareValidator.cs
- InputElement.cs
- HelpProvider.cs
- ServerValidateEventArgs.cs
- PhysicalOps.cs
- Gdiplus.cs
- MessageBox.cs
- DataGridSortCommandEventArgs.cs
- OdbcConnectionHandle.cs
- XamlGridLengthSerializer.cs
- WebUtil.cs
- SID.cs