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
- TabletDeviceInfo.cs
- WindowsTokenRoleProvider.cs
- RequestNavigateEventArgs.cs
- TextEffectCollection.cs
- BehaviorEditorPart.cs
- LZCodec.cs
- XPathNodeIterator.cs
- StreamUpdate.cs
- RequestResizeEvent.cs
- ContainerActivationHelper.cs
- BeginStoryboard.cs
- LoopExpression.cs
- DataGridViewColumnTypePicker.cs
- _SslStream.cs
- CustomAttributeSerializer.cs
- DbgCompiler.cs
- JsonCollectionDataContract.cs
- DataMember.cs
- ParallelEnumerableWrapper.cs
- HttpRuntimeSection.cs
- DesignerWidgets.cs
- MappingException.cs
- StorageRoot.cs
- XmlnsCompatibleWithAttribute.cs
- ConfigurationValidatorAttribute.cs
- UxThemeWrapper.cs
- OleCmdHelper.cs
- UnknownWrapper.cs
- ConfigsHelper.cs
- HttpCapabilitiesBase.cs
- StatusBar.cs
- TdsParserStaticMethods.cs
- WebControlParameterProxy.cs
- SystemColorTracker.cs
- BitmapMetadataBlob.cs
- SafeRightsManagementSessionHandle.cs
- brushes.cs
- PerformanceCountersElement.cs
- CodeNamespaceImportCollection.cs
- ResourceDisplayNameAttribute.cs
- TransformCollection.cs
- BooleanConverter.cs
- ScriptMethodAttribute.cs
- BuildProviderAppliesToAttribute.cs
- DiscoveryOperationContext.cs
- ContourSegment.cs
- Point3DKeyFrameCollection.cs
- PropertyPushdownHelper.cs
- EntityStoreSchemaFilterEntry.cs
- RootNamespaceAttribute.cs
- LayoutTableCell.cs
- BatchServiceHost.cs
- Wizard.cs
- EdmError.cs
- UInt32Converter.cs
- ChannelDispatcherCollection.cs
- WebResponse.cs
- ValueChangedEventManager.cs
- SelectManyQueryOperator.cs
- EntityParameter.cs
- ScrollBarRenderer.cs
- IndividualDeviceConfig.cs
- QilScopedVisitor.cs
- SpotLight.cs
- EllipseGeometry.cs
- TdsParserHelperClasses.cs
- DescendentsWalkerBase.cs
- IndexerNameAttribute.cs
- Win32Native.cs
- ColorMatrix.cs
- ModelVisual3D.cs
- OwnerDrawPropertyBag.cs
- UrlPropertyAttribute.cs
- SoapCodeExporter.cs
- AutomationElementCollection.cs
- AssociationTypeEmitter.cs
- Point4D.cs
- XamlReader.cs
- PrintPreviewGraphics.cs
- UnsafeNativeMethods.cs
- ExpressionConverter.cs
- TextBoxRenderer.cs
- QuaternionRotation3D.cs
- DataReceivedEventArgs.cs
- WebPartVerbCollection.cs
- HttpAsyncResult.cs
- OracleColumn.cs
- TextOutput.cs
- DataListCommandEventArgs.cs
- DataBoundControl.cs
- MsdtcWrapper.cs
- WindowsScrollBarBits.cs
- counter.cs
- BinaryObjectReader.cs
- MenuItem.cs
- Reference.cs
- CustomWebEventKey.cs
- SiteMapNodeItemEventArgs.cs
- DataGridViewCellValueEventArgs.cs
- CryptoApi.cs