Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / xsp / System / Web / UI / WebControls / TemplateColumn.cs / 1305376 / TemplateColumn.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Web.UI.WebControls { using System; using System.Collections; using System.ComponentModel; using System.Web; using System.Web.UI; ////// // public class TemplateColumn : DataGridColumn { private ITemplate headerTemplate; private ITemplate footerTemplate; private ITemplate itemTemplate; private ITemplate editItemTemplate; ///Defines the template for controls layout within a /// ////// column. /// Initializes a new instance of the public TemplateColumn() { } ///class. /// /// [ Browsable(false), DefaultValue(null), WebSysDescription(SR.TemplateColumn_EditItemTemplate), PersistenceMode(PersistenceMode.InnerProperty), TemplateContainer(typeof(DataGridItem)) ] public virtual ITemplate EditItemTemplate { get { return editItemTemplate; } set { editItemTemplate = value; OnColumnChanged(); } } ///Specifies the ///that defines how items in edit mode are rendered. /// [ Browsable(false), DefaultValue(null), WebSysDescription(SR.TemplateColumn_FooterTemplate), PersistenceMode(PersistenceMode.InnerProperty), TemplateContainer(typeof(DataGridItem)) ] public virtual ITemplate FooterTemplate { get { return footerTemplate; } set { footerTemplate = value; OnColumnChanged(); } } ///Specifies the ///that defines how the control footer is rendered. /// [ Browsable(false), DefaultValue(null), WebSysDescription(SR.TemplateColumn_HeaderTemplate), PersistenceMode(PersistenceMode.InnerProperty), TemplateContainer(typeof(DataGridItem)) ] public virtual ITemplate HeaderTemplate { get { return headerTemplate; } set { headerTemplate = value; OnColumnChanged(); } } ///Specifies the ////// that defines how the control header is rendered. /// [ Browsable(false), DefaultValue(null), WebSysDescription(SR.TemplateColumn_ItemTemplate), PersistenceMode(PersistenceMode.InnerProperty), TemplateContainer(typeof(DataGridItem)) ] public virtual ITemplate ItemTemplate { get { return itemTemplate; } set { itemTemplate = value; OnColumnChanged(); } } ///Specifies the ///that defines how items are rendered. /// /// public override void InitializeCell(TableCell cell, int columnIndex, ListItemType itemType) { base.InitializeCell(cell, columnIndex, itemType); ITemplate contentTemplate = null; switch (itemType) { case ListItemType.Header: contentTemplate = headerTemplate; break; case ListItemType.Footer: contentTemplate = footerTemplate; break; case ListItemType.Item: case ListItemType.AlternatingItem: case ListItemType.SelectedItem: contentTemplate = itemTemplate; break; case ListItemType.EditItem: if (editItemTemplate != null) contentTemplate = editItemTemplate; else goto case ListItemType.Item; break; } if (contentTemplate != null) { // The base class might have added a control or some text for some cases // such as header text which need to be removed before // the corresponding template is used. // Note that setting text also has the effect of clearing out any controls. cell.Text = String.Empty; contentTemplate.InstantiateIn(cell); } else { if (itemType == ListItemType.Item || itemType == ListItemType.AlternatingItem || itemType == ListItemType.SelectedItem || itemType == ListItemType.EditItem) { cell.Text = " "; } } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- FilterableAttribute.cs
- SiteMapProvider.cs
- SqlDataSourceConfigureSelectPanel.cs
- remotingproxy.cs
- CreateUserErrorEventArgs.cs
- CompilerCollection.cs
- CodeRemoveEventStatement.cs
- CommentGlyph.cs
- IntersectQueryOperator.cs
- TableLayoutPanelCellPosition.cs
- DelegatedStream.cs
- QueryStatement.cs
- Region.cs
- EncodingNLS.cs
- TreeNodeCollection.cs
- VectorAnimationUsingKeyFrames.cs
- ListBindingHelper.cs
- ImageAttributes.cs
- ServicePoint.cs
- GuidelineCollection.cs
- Simplifier.cs
- SharedPerformanceCounter.cs
- TypeLoadException.cs
- SystemIPInterfaceStatistics.cs
- PrimitiveXmlSerializers.cs
- HyperLink.cs
- ReadOnlyDataSourceView.cs
- WindowsClaimSet.cs
- SymbolTable.cs
- EntityDataSourceContextDisposingEventArgs.cs
- ChannelServices.cs
- ActivityBuilderXamlWriter.cs
- FailedToStartupUIException.cs
- XslException.cs
- PreviewPrintController.cs
- WindowsUpDown.cs
- SharedPersonalizationStateInfo.cs
- IIS7WorkerRequest.cs
- HttpWebResponse.cs
- PageEventArgs.cs
- HierarchicalDataSourceIDConverter.cs
- HtmlMobileTextWriter.cs
- StyleSelector.cs
- CodePageEncoding.cs
- SecurityPolicySection.cs
- LinkUtilities.cs
- HttpException.cs
- WindowsFormsSynchronizationContext.cs
- PrivilegeNotHeldException.cs
- SerializationInfo.cs
- CompoundFileDeflateTransform.cs
- TextParentUndoUnit.cs
- TransactionFormatter.cs
- ExtenderControl.cs
- SecondaryIndexList.cs
- propertyentry.cs
- DateTimeValueSerializerContext.cs
- ForceCopyBuildProvider.cs
- WebDescriptionAttribute.cs
- IdnElement.cs
- TouchesOverProperty.cs
- Vector3DKeyFrameCollection.cs
- TraceListener.cs
- ClientSettingsSection.cs
- TextRangeEditTables.cs
- TemplateContentLoader.cs
- SQLMoneyStorage.cs
- PeerNameRecordCollection.cs
- GacUtil.cs
- QilScopedVisitor.cs
- XappLauncher.cs
- PartialArray.cs
- DataBindingExpressionBuilder.cs
- ToolboxItemCollection.cs
- DynamicPropertyHolder.cs
- AttachedPropertyInfo.cs
- ObjectFactoryCodeDomTreeGenerator.cs
- IDReferencePropertyAttribute.cs
- ForceCopyBuildProvider.cs
- XmlSignatureManifest.cs
- Authorization.cs
- IdentityVerifier.cs
- GiveFeedbackEventArgs.cs
- HyperLinkField.cs
- BlobPersonalizationState.cs
- WindowsListViewGroup.cs
- TranslateTransform3D.cs
- ContextMenuService.cs
- UserControl.cs
- OrderToken.cs
- XmlSchemaExporter.cs
- SafeCertificateStore.cs
- RadioButtonList.cs
- DataView.cs
- COM2TypeInfoProcessor.cs
- Rijndael.cs
- EmbeddedMailObjectsCollection.cs
- Propagator.cs
- PanelStyle.cs
- SafeLocalMemHandle.cs