Code:
/ FXUpdate3074 / FXUpdate3074 / 1.1 / DEVDIV / depot / DevDiv / releases / 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. //------------------------------------------------------------------------------ //// 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
- ControlEvent.cs
- HtmlControlAdapter.cs
- VisualStyleInformation.cs
- KeyboardNavigation.cs
- OleDbPropertySetGuid.cs
- CompModHelpers.cs
- XmlSchemaElement.cs
- IndexerNameAttribute.cs
- ControlEvent.cs
- PictureBox.cs
- WasAdminWrapper.cs
- Floater.cs
- Expression.cs
- ListViewEditEventArgs.cs
- TemplateBindingExpressionConverter.cs
- AuditLog.cs
- SynchronizedPool.cs
- DataTemplateKey.cs
- FontStyles.cs
- ActivityDesignerAccessibleObject.cs
- DropDownList.cs
- InvariantComparer.cs
- SequenceQuery.cs
- IntersectQueryOperator.cs
- JulianCalendar.cs
- DBNull.cs
- SQLByte.cs
- Pointer.cs
- DataSourceCacheDurationConverter.cs
- EventToken.cs
- BindToObject.cs
- SafeArchiveContext.cs
- ServiceDescription.cs
- Nodes.cs
- SymbolTable.cs
- DataBindingExpressionBuilder.cs
- DataGridHeaderBorder.cs
- PageBuildProvider.cs
- Overlapped.cs
- NetStream.cs
- SplineQuaternionKeyFrame.cs
- QuestionEventArgs.cs
- DataColumnSelectionConverter.cs
- DownloadProgressEventArgs.cs
- CodeCommentStatement.cs
- ParameterElement.cs
- OleDbPermission.cs
- TextRange.cs
- PropertyFilter.cs
- FreeFormDesigner.cs
- ObjectSet.cs
- EmissiveMaterial.cs
- BindingList.cs
- CodeObject.cs
- WasNotInstalledException.cs
- ConcurrencyMode.cs
- QueryTreeBuilder.cs
- AttributeInfo.cs
- HtmlInputControl.cs
- DataGridViewAdvancedBorderStyle.cs
- FontResourceCache.cs
- Walker.cs
- WindowsListViewScroll.cs
- IndexedString.cs
- CodeNamespaceImportCollection.cs
- PrimitiveXmlSerializers.cs
- FixedSchema.cs
- BamlLocalizabilityResolver.cs
- WeakReferenceList.cs
- ICspAsymmetricAlgorithm.cs
- PersonalizationState.cs
- HttpHandler.cs
- InputLanguage.cs
- IncomingWebResponseContext.cs
- EntityCommand.cs
- EnumerableRowCollection.cs
- TrailingSpaceComparer.cs
- BufferBuilder.cs
- XmlExceptionHelper.cs
- TreeBuilderBamlTranslator.cs
- DependencyPropertyKey.cs
- StorageComplexPropertyMapping.cs
- Geometry.cs
- UserControlDesigner.cs
- XmlUtil.cs
- ValueQuery.cs
- login.cs
- ImageIndexConverter.cs
- HMACSHA1.cs
- XamlBrushSerializer.cs
- AuthenticationManager.cs
- ConstructorNeedsTagAttribute.cs
- FlowDocumentScrollViewerAutomationPeer.cs
- SurrogateDataContract.cs
- CodeTypeParameterCollection.cs
- HelpProvider.cs
- EditorPartCollection.cs
- ContainerParaClient.cs
- SqlUserDefinedTypeAttribute.cs
- NullableDoubleSumAggregationOperator.cs