Code:
/ FXUpdate3074 / FXUpdate3074 / 1.1 / untmp / whidbey / QFE / 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.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ListBoxItem.cs
- SelectedGridItemChangedEvent.cs
- SqlMethodTransformer.cs
- TextRunCache.cs
- BaseHashHelper.cs
- _IPv4Address.cs
- BitmapData.cs
- ObjectAnimationUsingKeyFrames.cs
- VariantWrapper.cs
- Math.cs
- PageAsyncTaskManager.cs
- ToolStripRendererSwitcher.cs
- SafeMemoryMappedFileHandle.cs
- HighlightComponent.cs
- HttpListenerException.cs
- TableColumn.cs
- DBSchemaTable.cs
- TextTreeFixupNode.cs
- ProfileSettingsCollection.cs
- DecoderFallbackWithFailureFlag.cs
- MouseWheelEventArgs.cs
- SharedPersonalizationStateInfo.cs
- xsdvalidator.cs
- Types.cs
- PropertyMetadata.cs
- Win32SafeHandles.cs
- IPEndPoint.cs
- DateTimeOffsetConverter.cs
- NamespaceEmitter.cs
- sqlcontext.cs
- BoolExpr.cs
- PathData.cs
- TokenDescriptor.cs
- DynamicMethod.cs
- TextElementEditingBehaviorAttribute.cs
- DebugViewWriter.cs
- DefinitionUpdate.cs
- SeverityFilter.cs
- PixelFormatConverter.cs
- InputScopeAttribute.cs
- ToolStripDropDownItem.cs
- DbSetClause.cs
- GridLengthConverter.cs
- XmlIncludeAttribute.cs
- BackEase.cs
- DispatchChannelSink.cs
- _SecureChannel.cs
- EntityContainer.cs
- NameTable.cs
- ErrorRuntimeConfig.cs
- Config.cs
- PartialList.cs
- DesignTimeDataBinding.cs
- CircleHotSpot.cs
- ScriptingWebServicesSectionGroup.cs
- CompiledRegexRunner.cs
- ReflectPropertyDescriptor.cs
- FileSystemWatcher.cs
- PerformanceCountersElement.cs
- DecimalAnimationBase.cs
- ToolstripProfessionalRenderer.cs
- CodeAccessPermission.cs
- ServiceEndpointElementCollection.cs
- AccessDataSourceView.cs
- SiteMapPathDesigner.cs
- InstanceLockQueryResult.cs
- SerialErrors.cs
- EncryptedXml.cs
- HtmlTextViewAdapter.cs
- GuidConverter.cs
- ObjectViewFactory.cs
- ClientBuildManagerTypeDescriptionProviderBridge.cs
- ValidatorCompatibilityHelper.cs
- Shared.cs
- DbConnectionOptions.cs
- BitmapMetadata.cs
- PrintingPermission.cs
- CodePageUtils.cs
- WebPartActionVerb.cs
- DebugView.cs
- Blend.cs
- Ref.cs
- AllMembershipCondition.cs
- UshortList2.cs
- MediaCommands.cs
- SystemIPInterfaceProperties.cs
- PassportAuthenticationModule.cs
- CustomDictionarySources.cs
- CalendarButtonAutomationPeer.cs
- KnownBoxes.cs
- InternalPermissions.cs
- EpmContentDeSerializerBase.cs
- DocumentApplicationJournalEntry.cs
- MetadataProperty.cs
- ToolStripItemBehavior.cs
- ColorConvertedBitmap.cs
- SchemaNotation.cs
- TypeDependencyAttribute.cs
- CodeBinaryOperatorExpression.cs
- XmlSchemaDatatype.cs