Code:
/ FX-1434 / FX-1434 / 1.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
- SpellerInterop.cs
- Crc32.cs
- HyperLink.cs
- XappLauncher.cs
- CheckedPointers.cs
- SchemaCollectionPreprocessor.cs
- ServiceRouteHandler.cs
- ResourceReferenceExpression.cs
- FormsAuthentication.cs
- dataSvcMapFileLoader.cs
- PageOutputColor.cs
- SvcMapFileSerializer.cs
- ParameterExpression.cs
- IPAddress.cs
- RpcAsyncResult.cs
- Base64Stream.cs
- PrivilegeNotHeldException.cs
- PermissionToken.cs
- ApplicationId.cs
- VectorConverter.cs
- TextWriterTraceListener.cs
- Rule.cs
- lengthconverter.cs
- documentsequencetextcontainer.cs
- DeviceSpecific.cs
- _BufferOffsetSize.cs
- HtmlInputHidden.cs
- PerformanceCounterCategory.cs
- OptimalBreakSession.cs
- UnconditionalPolicy.cs
- WebSysDefaultValueAttribute.cs
- LoopExpression.cs
- TableParaClient.cs
- _AuthenticationState.cs
- PagePropertiesChangingEventArgs.cs
- StylusPointCollection.cs
- ColorBlend.cs
- DetailsViewRow.cs
- XmlRawWriter.cs
- MonitoringDescriptionAttribute.cs
- HierarchicalDataSourceConverter.cs
- OuterGlowBitmapEffect.cs
- WebReferencesBuildProvider.cs
- File.cs
- WindowsAltTab.cs
- DirectoryObjectSecurity.cs
- AccessDataSourceView.cs
- DesignerSerializationOptionsAttribute.cs
- FlowDocumentScrollViewerAutomationPeer.cs
- _NegotiateClient.cs
- WinHttpWebProxyFinder.cs
- RadioButtonStandardAdapter.cs
- Authorization.cs
- BoundField.cs
- RSAPKCS1KeyExchangeFormatter.cs
- SiteMapNode.cs
- COM2ExtendedBrowsingHandler.cs
- SatelliteContractVersionAttribute.cs
- ChildDocumentBlock.cs
- BidOverLoads.cs
- GridViewRowCollection.cs
- WeakReferenceEnumerator.cs
- TraceSwitch.cs
- WebPartDisplayModeCollection.cs
- InternalRelationshipCollection.cs
- InvalidCastException.cs
- DataGridViewTopRowAccessibleObject.cs
- KnownBoxes.cs
- CodeArrayIndexerExpression.cs
- RadialGradientBrush.cs
- OracleDataAdapter.cs
- Span.cs
- SystemInfo.cs
- TimeSpanSecondsOrInfiniteConverter.cs
- SystemIPv4InterfaceProperties.cs
- DataGridComponentEditor.cs
- CategoryNameCollection.cs
- KeyInterop.cs
- WindowsHyperlink.cs
- LogicalExpressionTypeConverter.cs
- ConnectivityStatus.cs
- SineEase.cs
- Base64WriteStateInfo.cs
- AddInDeploymentState.cs
- StateManagedCollection.cs
- SchemaImporterExtensionsSection.cs
- PageRouteHandler.cs
- LinkConverter.cs
- MatchingStyle.cs
- SctClaimDictionary.cs
- DocumentPropertiesDialog.cs
- DocumentEventArgs.cs
- TextSelection.cs
- MulticastDelegate.cs
- XmlUnspecifiedAttribute.cs
- XmlTextReader.cs
- Int32Storage.cs
- DebuggerService.cs
- TogglePattern.cs
- HostProtectionPermission.cs