Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / xsp / System / DynamicData / DynamicData / DataBoundControlParameterTarget.cs / 1305376 / DataBoundControlParameterTarget.cs
namespace System.Web.DynamicData { using System; using System.Collections.Generic; using System.Linq; using System.Web.UI; using System.Web.UI.WebControls; using System.Globalization; internal class DataBoundControlParameterTarget : IControlParameterTarget { private Control _control; public DataBoundControlParameterTarget(Control control) { if (control == null) { throw new ArgumentNullException("control"); } _control = control; } public MetaTable Table { get { return _control.FindMetaTable(); } } public MetaColumn FilteredColumn { get { return null; } } public string GetPropertyNameExpression(string columnName) { // Get the DataKeyPropertyAttribute and use that as the to get the correct property name expression DataKeyPropertyAttribute attribute = _control.GetType().GetCustomAttributes(true).OfType().FirstOrDefault(); if ((attribute != null) && !String.IsNullOrEmpty(attribute.Name)) { return attribute.Name + String.Format(CultureInfo.InvariantCulture, "['{0}']", columnName); } // return String.Empty; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved. namespace System.Web.DynamicData { using System; using System.Collections.Generic; using System.Linq; using System.Web.UI; using System.Web.UI.WebControls; using System.Globalization; internal class DataBoundControlParameterTarget : IControlParameterTarget { private Control _control; public DataBoundControlParameterTarget(Control control) { if (control == null) { throw new ArgumentNullException("control"); } _control = control; } public MetaTable Table { get { return _control.FindMetaTable(); } } public MetaColumn FilteredColumn { get { return null; } } public string GetPropertyNameExpression(string columnName) { // Get the DataKeyPropertyAttribute and use that as the to get the correct property name expression DataKeyPropertyAttribute attribute = _control.GetType().GetCustomAttributes(true).OfType ().FirstOrDefault(); if ((attribute != null) && !String.IsNullOrEmpty(attribute.Name)) { return attribute.Name + String.Format(CultureInfo.InvariantCulture, "['{0}']", columnName); } // return String.Empty; } } } // 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
- recordstatescratchpad.cs
- Debug.cs
- TextElementEnumerator.cs
- GridItemProviderWrapper.cs
- MailAddressCollection.cs
- SystemTcpConnection.cs
- EventToken.cs
- ObjectTypeMapping.cs
- PackageProperties.cs
- Stroke.cs
- MasterPageCodeDomTreeGenerator.cs
- DebugController.cs
- PrinterSettings.cs
- HttpDictionary.cs
- Inflater.cs
- ControlIdConverter.cs
- MetafileEditor.cs
- SqlReorderer.cs
- GrowingArray.cs
- RenderDataDrawingContext.cs
- IIS7WorkerRequest.cs
- Util.cs
- Calendar.cs
- XsltContext.cs
- EndOfStreamException.cs
- IisNotInstalledException.cs
- FormsAuthenticationTicket.cs
- CrossAppDomainChannel.cs
- CodeTypeReferenceCollection.cs
- ImageListUtils.cs
- OrderedHashRepartitionEnumerator.cs
- Parser.cs
- CodeCommentStatementCollection.cs
- DynamicAttribute.cs
- FindCriteriaCD1.cs
- EdmItemCollection.cs
- Animatable.cs
- RtfToken.cs
- UriTemplateEquivalenceComparer.cs
- KnownBoxes.cs
- CryptoApi.cs
- DesignerVerbCollection.cs
- Pens.cs
- ConstructorNeedsTagAttribute.cs
- UriTemplateEquivalenceComparer.cs
- ClientEventManager.cs
- TemplateNameScope.cs
- SettingsSavedEventArgs.cs
- dbdatarecord.cs
- DecimalAnimationUsingKeyFrames.cs
- HttpModulesInstallComponent.cs
- RuntimeEnvironment.cs
- XmlChildEnumerator.cs
- RecognizedWordUnit.cs
- RunClient.cs
- RecommendedAsConfigurableAttribute.cs
- TypeSystem.cs
- Solver.cs
- DBBindings.cs
- MemberInfoSerializationHolder.cs
- HwndSubclass.cs
- ProxyWebPartConnectionCollection.cs
- StringUtil.cs
- SqlNode.cs
- SqlParameter.cs
- InlinedAggregationOperator.cs
- ValueQuery.cs
- XsltSettings.cs
- ModifyActivitiesPropertyDescriptor.cs
- BufferModesCollection.cs
- FaultPropagationQuery.cs
- TextChangedEventArgs.cs
- SyndicationSerializer.cs
- CookielessHelper.cs
- RepeatBehaviorConverter.cs
- ConfigurationElement.cs
- ReaderWriterLock.cs
- OdbcInfoMessageEvent.cs
- XmlArrayItemAttributes.cs
- SmiContext.cs
- EventRouteFactory.cs
- UInt32.cs
- ContentType.cs
- XpsSerializerWriter.cs
- TextWriter.cs
- AmbientEnvironment.cs
- SemanticKeyElement.cs
- Win32.cs
- Bezier.cs
- SqlParameterCollection.cs
- QuaternionAnimationBase.cs
- peersecuritysettings.cs
- MediaTimeline.cs
- PageCodeDomTreeGenerator.cs
- XmlDataSource.cs
- PaperSource.cs
- TextHintingModeValidation.cs
- _UriTypeConverter.cs
- ObjectStateEntryDbUpdatableDataRecord.cs
- SqlCacheDependencySection.cs