Code:
/ FXUpdate3074 / FXUpdate3074 / 1.1 / untmp / whidbey / QFE / ndp / fx / src / xsp / System / Web / UI / DataSourceHelper.cs / 1 / DataSourceHelper.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Web.UI { using System; using System.Collections; using System.ComponentModel; using System.ComponentModel.Design; using System.Data; internal sealed class DataSourceHelper { private DataSourceHelper() { } internal static IEnumerable GetResolvedDataSource(object dataSource, string dataMember) { if (dataSource == null) return null; IListSource listSource = dataSource as IListSource; if (listSource != null) { IList memberList = listSource.GetList(); if (listSource.ContainsListCollection == false) { // the returned list is itself the list we need to bind to // return (IEnumerable)memberList; } if ((memberList != null) && (memberList is ITypedList)) { ITypedList typedMemberList = (ITypedList)memberList; PropertyDescriptorCollection propDescs = typedMemberList.GetItemProperties(new PropertyDescriptor[0]); if ((propDescs != null) && (propDescs.Count != 0)) { PropertyDescriptor listProperty = null; if (String.IsNullOrEmpty(dataMember)) { listProperty = propDescs[0]; } else { listProperty = propDescs.Find(dataMember, true); } if (listProperty != null) { object listRow = memberList[0]; object list = listProperty.GetValue(listRow); if ((list != null) && (list is IEnumerable)) { return (IEnumerable)list; } } throw new HttpException(SR.GetString(SR.ListSource_Missing_DataMember, dataMember)); } else { throw new HttpException(SR.GetString(SR.ListSource_Without_DataMembers)); } } } if (dataSource is IEnumerable) { return (IEnumerable)dataSource; } return null; } } } // 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
- Viewport2DVisual3D.cs
- StorageEntityTypeMapping.cs
- BoundingRectTracker.cs
- Matrix3DStack.cs
- ValueConversionAttribute.cs
- contentDescriptor.cs
- AlignmentXValidation.cs
- DataObjectFieldAttribute.cs
- Matrix.cs
- DefaultParameterValueAttribute.cs
- SqlCharStream.cs
- IProducerConsumerCollection.cs
- DataTable.cs
- WinFormsSpinner.cs
- FormsAuthenticationEventArgs.cs
- MessageQueuePermissionEntry.cs
- EditableTreeList.cs
- StateBag.cs
- Screen.cs
- CurrentChangingEventArgs.cs
- DbQueryCommandTree.cs
- HttpException.cs
- TreeNodeSelectionProcessor.cs
- WebPartPersonalization.cs
- TemplateNodeContextMenu.cs
- BooleanFunctions.cs
- RIPEMD160Managed.cs
- CookieHandler.cs
- XmlC14NWriter.cs
- ListControlConvertEventArgs.cs
- EntryWrittenEventArgs.cs
- ConfigurationStrings.cs
- XmlWriterDelegator.cs
- Utils.cs
- JsonUriDataContract.cs
- AuthenticationModeHelper.cs
- WebProxyScriptElement.cs
- TemplateKeyConverter.cs
- BinaryParser.cs
- Source.cs
- Line.cs
- ChameleonKey.cs
- ExpressionBindingsDialog.cs
- ButtonBase.cs
- xmlformatgeneratorstatics.cs
- ScopeElementCollection.cs
- CacheMemory.cs
- ItemList.cs
- DeferredTextReference.cs
- ObjectIDGenerator.cs
- Socket.cs
- httpapplicationstate.cs
- Adorner.cs
- ResourcesChangeInfo.cs
- InstanceCompleteException.cs
- CustomPopupPlacement.cs
- CompiledAction.cs
- AttachmentCollection.cs
- Italic.cs
- ellipse.cs
- ValidatingReaderNodeData.cs
- BitmapEffectInputData.cs
- KeyTime.cs
- ComplexPropertyEntry.cs
- SyndicationContent.cs
- PenLineCapValidation.cs
- DeferrableContentConverter.cs
- NoPersistHandle.cs
- WindowsRichEdit.cs
- XmlSchemaObjectTable.cs
- DataBoundControlHelper.cs
- DisplayMemberTemplateSelector.cs
- Propagator.Evaluator.cs
- XmlLoader.cs
- XmlEntity.cs
- XmlChoiceIdentifierAttribute.cs
- HTTP_SERVICE_CONFIG_URLACL_KEY.cs
- _SSPIWrapper.cs
- MessageQueueCriteria.cs
- FaultContext.cs
- ReadOnlyPropertyMetadata.cs
- HttpDictionary.cs
- basevalidator.cs
- BuilderInfo.cs
- ControlFilterExpression.cs
- DataFormat.cs
- Freezable.cs
- PriorityBindingExpression.cs
- TimeIntervalCollection.cs
- login.cs
- OdbcPermission.cs
- XmlDataProvider.cs
- TableLayoutRowStyleCollection.cs
- ResourceIDHelper.cs
- CompilationLock.cs
- SingleStorage.cs
- NameService.cs
- PatternMatcher.cs
- DataGrid.cs
- Popup.cs