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
- DataGridRowDetailsEventArgs.cs
- Int64KeyFrameCollection.cs
- DbLambda.cs
- User.cs
- ConnectionManagementSection.cs
- TextParaClient.cs
- EtwTrackingBehavior.cs
- EventMappingSettingsCollection.cs
- XmlDocumentSerializer.cs
- DataGridViewRow.cs
- GenericRootAutomationPeer.cs
- TextWriterEngine.cs
- IsolatedStorage.cs
- PrintDocument.cs
- DispatcherTimer.cs
- TransformCollection.cs
- EncoderParameter.cs
- HostProtectionPermission.cs
- XmlWellformedWriter.cs
- ModuleConfigurationInfo.cs
- ImageCodecInfoPrivate.cs
- NativeMethodsCLR.cs
- ProcessInfo.cs
- InstallerTypeAttribute.cs
- AlignmentYValidation.cs
- SqlServices.cs
- RoleManagerModule.cs
- CollectionMarkupSerializer.cs
- StagingAreaInputItem.cs
- ImageAutomationPeer.cs
- GenericEnumConverter.cs
- XmlILConstructAnalyzer.cs
- MenuItem.cs
- MarkupProperty.cs
- DataSpaceManager.cs
- PanningMessageFilter.cs
- CellRelation.cs
- CategoryAttribute.cs
- XmlSchemaObjectTable.cs
- DataStreams.cs
- FacetValueContainer.cs
- CompilerError.cs
- InheritanceAttribute.cs
- QilTypeChecker.cs
- TransformGroup.cs
- EntityViewGenerator.cs
- OneOfScalarConst.cs
- FunctionDescription.cs
- DelegateArgumentReference.cs
- BindingContext.cs
- LicenseContext.cs
- NameValuePermission.cs
- Merger.cs
- InputManager.cs
- _MultipleConnectAsync.cs
- RewritingSimplifier.cs
- MultiTargetingUtil.cs
- MimeTypeMapper.cs
- FileDetails.cs
- MenuStrip.cs
- SamlSecurityToken.cs
- Compilation.cs
- ControlAdapter.cs
- CodeCatchClauseCollection.cs
- InstancePersistenceEvent.cs
- DataGridCommandEventArgs.cs
- ReferentialConstraint.cs
- Activity.cs
- Rule.cs
- DbRetry.cs
- CodeDelegateInvokeExpression.cs
- Shape.cs
- CriticalFileToken.cs
- TreeNodeStyle.cs
- CompositeFontParser.cs
- ProcessModelInfo.cs
- MobileFormsAuthentication.cs
- DataGridViewLinkCell.cs
- TrackPoint.cs
- CharUnicodeInfo.cs
- PathFigureCollectionConverter.cs
- FileInfo.cs
- OperationContext.cs
- CodeAttributeDeclaration.cs
- SHA1Cng.cs
- brushes.cs
- QilInvokeEarlyBound.cs
- EdmFunction.cs
- ActivitySurrogate.cs
- ObjectDataSourceEventArgs.cs
- BitmapEffectDrawingContent.cs
- LogRecordSequence.cs
- WebPartDescription.cs
- IriParsingElement.cs
- RequestCacheEntry.cs
- AsyncStreamReader.cs
- ConstraintManager.cs
- GlyphTypeface.cs
- ResourceDescriptionAttribute.cs
- WindowsTreeView.cs