Code:
/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / ndp / fx / src / Designer / WebForms / System / Web / UI / Design / WebControls / DataBoundControlActionList.cs / 1 / DataBoundControlActionList.cs
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
namespace System.Web.UI.Design.WebControls {
using System;
using System.Collections;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Design;
using System.Diagnostics;
using System.Web.UI.Design;
using System.Web.UI.Design.Util;
using System.Web.UI.WebControls;
///
internal class DataBoundControlActionList : DesignerActionList {
private IDataSourceDesigner _dataSourceDesigner;
private ControlDesigner _controlDesigner;
///
public DataBoundControlActionList(ControlDesigner controlDesigner, IDataSourceDesigner dataSourceDesigner) : base(controlDesigner.Component) {
_controlDesigner = controlDesigner;
_dataSourceDesigner = dataSourceDesigner;
}
public override bool AutoShow {
get {
return true;
}
set {
}
}
///
[TypeConverterAttribute(typeof(DataSourceIDConverter))]
public string DataSourceID {
get {
string dataSourceID = null;
DataBoundControlDesigner dataBoundControlDesigner = _controlDesigner as DataBoundControlDesigner;
if (dataBoundControlDesigner != null) {
dataSourceID = dataBoundControlDesigner.DataSourceID;
}
else {
BaseDataListDesigner bdlDesigner = _controlDesigner as BaseDataListDesigner;
if (bdlDesigner != null) {
dataSourceID = bdlDesigner.DataSourceID;
}
else {
RepeaterDesigner repeaterDesigner = _controlDesigner as RepeaterDesigner;
if (repeaterDesigner != null) {
dataSourceID = repeaterDesigner.DataSourceID;
}
else {
Debug.Fail("Unknown type called DataBoundControlActionList");
}
}
}
if (String.IsNullOrEmpty(dataSourceID)) {
return SR.GetString(SR.DataSourceIDChromeConverter_NoDataSource);
}
return dataSourceID;
}
set {
ControlDesigner.InvokeTransactedChange(_controlDesigner.Component, new TransactedChangeCallback(SetDataSourceIDCallback), value, SR.GetString(SR.DataBoundControlActionList_SetDataSourceIDTransaction));
}
}
///
public override DesignerActionItemCollection GetSortedActionItems() {
DesignerActionItemCollection items = new DesignerActionItemCollection();
PropertyDescriptor pd = TypeDescriptor.GetProperties(_controlDesigner.Component)["DataSourceID"];
if (pd != null && pd.IsBrowsable) {
items.Add(new DesignerActionPropertyItem("DataSourceID",
SR.GetString(SR.BaseDataBoundControl_ConfigureDataVerb),
SR.GetString(SR.BaseDataBoundControl_DataActionGroup),
SR.GetString(SR.BaseDataBoundControl_ConfigureDataVerbDesc)));
}
// add associated tasks
ControlDesigner dsDesigner = _dataSourceDesigner as ControlDesigner;
if (dsDesigner != null) {
((DesignerActionPropertyItem)items[0]).RelatedComponent = dsDesigner.Component;
}
return items;
}
private bool SetDataSourceIDCallback(object context) {
string value = (string)context;
DataBoundControlDesigner dataBoundControlDesigner = _controlDesigner as DataBoundControlDesigner;
if (dataBoundControlDesigner != null) {
PropertyDescriptor dataSourceIDDescriptor = TypeDescriptor.GetProperties(dataBoundControlDesigner.Component)["DataSourceID"];
dataSourceIDDescriptor.SetValue(dataBoundControlDesigner.Component, value);
}
else {
BaseDataListDesigner bdlDesigner = _controlDesigner as BaseDataListDesigner;
if (bdlDesigner != null) {
PropertyDescriptor dataSourceIDDescriptor = TypeDescriptor.GetProperties(bdlDesigner.Component)["DataSourceID"];
dataSourceIDDescriptor.SetValue(bdlDesigner.Component, value);
}
else {
RepeaterDesigner repeaterDesigner = _controlDesigner as RepeaterDesigner;
if (repeaterDesigner != null) {
PropertyDescriptor dataSourceIDDescriptor = TypeDescriptor.GetProperties(repeaterDesigner.Component)["DataSourceID"];
dataSourceIDDescriptor.SetValue(repeaterDesigner.Component, value);
}
else {
Debug.Fail("Unknown type called DataBoundControlActionList");
}
}
}
return true;
}
}
}
// 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
- InputLanguageSource.cs
- ToolStripPanelRow.cs
- GrammarBuilderBase.cs
- Socket.cs
- BinaryFormatterWriter.cs
- InlinedAggregationOperatorEnumerator.cs
- DataServiceEntityAttribute.cs
- UInt64Converter.cs
- TransactionInformation.cs
- DataAdapter.cs
- PropertyManager.cs
- ProtocolsInstallComponent.cs
- Component.cs
- TypeReference.cs
- RangeValuePattern.cs
- ByteRangeDownloader.cs
- ScrollProviderWrapper.cs
- NativeMethods.cs
- UTF8Encoding.cs
- UpdatePanelTrigger.cs
- CodeValidator.cs
- InfoCardTrace.cs
- ArrayList.cs
- CompositeCollection.cs
- ListArgumentProvider.cs
- XPathScanner.cs
- Int64AnimationBase.cs
- documentsequencetextcontainer.cs
- MD5.cs
- XslCompiledTransform.cs
- AssociationTypeEmitter.cs
- sqlstateclientmanager.cs
- MetadataCache.cs
- GACMembershipCondition.cs
- Version.cs
- CheckBoxAutomationPeer.cs
- FontUnitConverter.cs
- ColumnBinding.cs
- Message.cs
- TransformPattern.cs
- Application.cs
- StrongNameKeyPair.cs
- DataColumnChangeEvent.cs
- WinFormsComponentEditor.cs
- AsyncCodeActivityContext.cs
- sortedlist.cs
- Processor.cs
- IntSecurity.cs
- ObjectQueryExecutionPlan.cs
- ListItemCollection.cs
- AlgoModule.cs
- ExtendedPropertyDescriptor.cs
- EdmRelationshipNavigationPropertyAttribute.cs
- DataGridViewRowCollection.cs
- BitVec.cs
- TaskExceptionHolder.cs
- WrappedReader.cs
- FormatException.cs
- AttributeTable.cs
- OdbcStatementHandle.cs
- FrameworkTextComposition.cs
- ToolStripDropDownClosingEventArgs.cs
- SByteStorage.cs
- TextRangeBase.cs
- Decoder.cs
- CheckPair.cs
- AppearanceEditorPart.cs
- XmlEncodedRawTextWriter.cs
- TdsRecordBufferSetter.cs
- EntityContainerRelationshipSetEnd.cs
- IndependentlyAnimatedPropertyMetadata.cs
- CapiSafeHandles.cs
- CustomAssemblyResolver.cs
- webeventbuffer.cs
- ParserExtension.cs
- DataException.cs
- OleDbDataAdapter.cs
- SystemIPv6InterfaceProperties.cs
- AssemblyCollection.cs
- SchemaRegistration.cs
- CreateUserWizardAutoFormat.cs
- SqlBulkCopyColumnMappingCollection.cs
- XsdBuildProvider.cs
- SspiSecurityTokenProvider.cs
- DataPagerFieldCollection.cs
- ProxyHelper.cs
- CodeIndexerExpression.cs
- DocumentXmlWriter.cs
- DataGridViewControlCollection.cs
- PartialCachingAttribute.cs
- AuthorizationRuleCollection.cs
- TraceLog.cs
- PropertySegmentSerializationProvider.cs
- NotifyInputEventArgs.cs
- BoundPropertyEntry.cs
- EntityDataSourceWrapperCollection.cs
- HtmlInputHidden.cs
- DbDataReader.cs
- InputElement.cs
- ObjectSecurity.cs