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
- CounterSet.cs
- ToolBarPanel.cs
- ValidationRuleCollection.cs
- UnsafeNativeMethods.cs
- TextProperties.cs
- PasswordTextContainer.cs
- XmlSchemaGroup.cs
- IOThreadTimer.cs
- MonthCalendarDesigner.cs
- DataGridViewCellParsingEventArgs.cs
- PrintDialog.cs
- Options.cs
- StateInitializationDesigner.cs
- ToggleButton.cs
- Int32KeyFrameCollection.cs
- Int64Converter.cs
- TextDocumentView.cs
- MDIClient.cs
- ConstraintEnumerator.cs
- Boolean.cs
- LinqDataSourceUpdateEventArgs.cs
- ContentElement.cs
- Model3DGroup.cs
- XmlILTrace.cs
- ExpressionPrefixAttribute.cs
- SqlTopReducer.cs
- ObjectConverter.cs
- TemplatedMailWebEventProvider.cs
- GlobalItem.cs
- WebPartCancelEventArgs.cs
- DesignTimeParseData.cs
- TemplateLookupAction.cs
- oledbmetadatacollectionnames.cs
- TextSpanModifier.cs
- CAGDesigner.cs
- MatchNoneMessageFilter.cs
- ValueType.cs
- BmpBitmapDecoder.cs
- CellTreeNodeVisitors.cs
- SafeSecurityHandles.cs
- XNodeValidator.cs
- XmlIterators.cs
- WebPartConnectionsEventArgs.cs
- XamlInt32CollectionSerializer.cs
- DiscoveryClientDocuments.cs
- CreateParams.cs
- SqlInternalConnectionSmi.cs
- UnsignedPublishLicense.cs
- LinkArea.cs
- RawUIStateInputReport.cs
- EncodingInfo.cs
- FullTextState.cs
- BindingMemberInfo.cs
- RegistryConfigurationProvider.cs
- SchemaObjectWriter.cs
- ViewgenGatekeeper.cs
- ExtendedPropertyCollection.cs
- XmlSchemaComplexContentExtension.cs
- FormsAuthenticationModule.cs
- DataControlButton.cs
- Bezier.cs
- EventlogProvider.cs
- HScrollProperties.cs
- HashRepartitionStream.cs
- XmlSchemaInclude.cs
- IntSecurity.cs
- InterleavedZipPartStream.cs
- ConfigurationStrings.cs
- RegistrySecurity.cs
- CustomAssemblyResolver.cs
- IssuerInformation.cs
- Perspective.cs
- VBIdentifierName.cs
- LinqDataSourceDeleteEventArgs.cs
- LoginStatusDesigner.cs
- EdmFunction.cs
- PrePostDescendentsWalker.cs
- Stroke.cs
- TabRenderer.cs
- ClientUrlResolverWrapper.cs
- BrowserDefinitionCollection.cs
- VerificationAttribute.cs
- HttpRuntime.cs
- SoapAttributes.cs
- StorageTypeMapping.cs
- DiscoveryServiceExtension.cs
- EdgeProfileValidation.cs
- ActiveXHost.cs
- RoleGroupCollection.cs
- XmlArrayItemAttributes.cs
- XpsFontSerializationService.cs
- RegistryPermission.cs
- FlowDocumentScrollViewer.cs
- Animatable.cs
- TransportContext.cs
- FocusWithinProperty.cs
- BufferedMessageData.cs
- TextParaClient.cs
- JulianCalendar.cs
- StructureChangedEventArgs.cs