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
- CorrelationResolver.cs
- GB18030Encoding.cs
- DBParameter.cs
- EntityParameter.cs
- DataGridPageChangedEventArgs.cs
- DataRecordInternal.cs
- EnumConverter.cs
- TreeViewCancelEvent.cs
- PersonalizablePropertyEntry.cs
- MenuAutoFormat.cs
- ServerTooBusyException.cs
- XmlCountingReader.cs
- SeverityFilter.cs
- XmlHierarchicalDataSourceView.cs
- Point3DCollection.cs
- XmlDownloadManager.cs
- ConnectionManagementElementCollection.cs
- FirstMatchCodeGroup.cs
- ScriptControlManager.cs
- FixedSOMGroup.cs
- EntityTransaction.cs
- EdmRelationshipRoleAttribute.cs
- Pool.cs
- XmlSchemaComplexType.cs
- DescendentsWalkerBase.cs
- MimeMultiPart.cs
- ThicknessAnimationBase.cs
- AuthorizationRuleCollection.cs
- TrustSection.cs
- EntityDataSourceContextCreatingEventArgs.cs
- X509SecurityTokenParameters.cs
- Tablet.cs
- HtmlShimManager.cs
- SevenBitStream.cs
- SafeEventHandle.cs
- XPathAncestorQuery.cs
- VSDExceptions.cs
- WebPartDeleteVerb.cs
- TransformerTypeCollection.cs
- DesignerListAdapter.cs
- GradientStop.cs
- _Events.cs
- SchemaSetCompiler.cs
- DetailsViewCommandEventArgs.cs
- SystemIcons.cs
- RoleManagerModule.cs
- TextDecorationLocationValidation.cs
- SystemWebCachingSectionGroup.cs
- InputProviderSite.cs
- SpeakCompletedEventArgs.cs
- CodeNamespace.cs
- GroupDescription.cs
- ExceptionUtil.cs
- WindowsEditBoxRange.cs
- BevelBitmapEffect.cs
- NameValueSectionHandler.cs
- CmsInterop.cs
- MdiWindowListStrip.cs
- IntSumAggregationOperator.cs
- HttpStreamMessageEncoderFactory.cs
- XMLSyntaxException.cs
- GB18030Encoding.cs
- ClientUrlResolverWrapper.cs
- PartManifestEntry.cs
- ListDictionaryInternal.cs
- PageContentAsyncResult.cs
- CorrelationHandle.cs
- AssemblyHash.cs
- UserUseLicenseDictionaryLoader.cs
- DetailsViewPagerRow.cs
- RowToParametersTransformer.cs
- SiteIdentityPermission.cs
- FrameSecurityDescriptor.cs
- PocoEntityKeyStrategy.cs
- UnderstoodHeaders.cs
- ToolStripOverflowButton.cs
- XamlBrushSerializer.cs
- WizardSideBarListControlItem.cs
- PathSegmentCollection.cs
- FileLevelControlBuilderAttribute.cs
- SR.cs
- RemotingAttributes.cs
- EpmContentDeSerializer.cs
- TextEndOfLine.cs
- SupportsEventValidationAttribute.cs
- Mapping.cs
- EncoderParameters.cs
- AssemblyFilter.cs
- MissingFieldException.cs
- EasingKeyFrames.cs
- RotateTransform.cs
- BooleanExpr.cs
- HtmlInputCheckBox.cs
- ComponentCollection.cs
- BitStack.cs
- DesignerActionMethodItem.cs
- ClientProtocol.cs
- RepeatButtonAutomationPeer.cs
- NetworkStream.cs
- EncoderFallback.cs