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
- SqlBuilder.cs
- DriveInfo.cs
- StructuralComparisons.cs
- NamedObject.cs
- FontInfo.cs
- Pipe.cs
- LinqDataSourceStatusEventArgs.cs
- ScrollPattern.cs
- CompareValidator.cs
- NotImplementedException.cs
- DataGrid.cs
- ReachDocumentReferenceSerializer.cs
- MetadataExchangeClient.cs
- SequentialOutput.cs
- Merger.cs
- iisPickupDirectory.cs
- DefaultAsyncDataDispatcher.cs
- TaskExtensions.cs
- UpdateRecord.cs
- StrongNamePublicKeyBlob.cs
- ArglessEventHandlerProxy.cs
- ControlBuilderAttribute.cs
- GridProviderWrapper.cs
- TreeViewImageIndexConverter.cs
- ResourceSet.cs
- ControlBindingsCollection.cs
- BooleanFunctions.cs
- HttpEncoder.cs
- TextProviderWrapper.cs
- MethodCallExpression.cs
- EventLogReader.cs
- EventWaitHandleSecurity.cs
- KeyConverter.cs
- Cursor.cs
- Propagator.cs
- ActivityDefaults.cs
- Effect.cs
- ComEventsMethod.cs
- SecuritySessionSecurityTokenAuthenticator.cs
- WhiteSpaceTrimStringConverter.cs
- RectangleGeometry.cs
- Stylus.cs
- SiteMapPathDesigner.cs
- DataGridViewCellParsingEventArgs.cs
- GcHandle.cs
- WinEventQueueItem.cs
- SHA256.cs
- TransformationRules.cs
- HMAC.cs
- FixedFindEngine.cs
- SafeCryptHandles.cs
- UniformGrid.cs
- GradientStop.cs
- ObjectDataSourceEventArgs.cs
- ChannelTerminatedException.cs
- _IPv6Address.cs
- Attachment.cs
- PartialCachingAttribute.cs
- BaseTreeIterator.cs
- GenericUriParser.cs
- DataListCommandEventArgs.cs
- XPathConvert.cs
- SkewTransform.cs
- EditingCommands.cs
- WebPartConnectionsCancelEventArgs.cs
- UpdateCompiler.cs
- PostBackOptions.cs
- FrameworkContentElement.cs
- SqlMethods.cs
- QueryExpr.cs
- FileInfo.cs
- DeflateStreamAsyncResult.cs
- Double.cs
- ColorTransform.cs
- Enlistment.cs
- Command.cs
- AsyncCodeActivity.cs
- TransformerConfigurationWizardBase.cs
- BamlVersionHeader.cs
- ChtmlTextBoxAdapter.cs
- FunctionImportMapping.cs
- SetStoryboardSpeedRatio.cs
- DependencyPropertyChangedEventArgs.cs
- ProviderUtil.cs
- XmlConvert.cs
- _HeaderInfoTable.cs
- ListView.cs
- ping.cs
- InputReferenceExpression.cs
- DataListItem.cs
- BaseParser.cs
- SymmetricKey.cs
- ZipIOCentralDirectoryBlock.cs
- XmlSchemaComplexContent.cs
- dtdvalidator.cs
- XamlToRtfParser.cs
- EmptyStringExpandableObjectConverter.cs
- ToolboxService.cs
- FieldToken.cs
- TreeViewDesigner.cs