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
- XmlSchemaSubstitutionGroup.cs
- AudioFileOut.cs
- SHA384Cng.cs
- CodeArgumentReferenceExpression.cs
- ProxyWebPart.cs
- DebugHandleTracker.cs
- DynamicPropertyHolder.cs
- ShapingWorkspace.cs
- PreservationFileWriter.cs
- Sequence.cs
- TextServicesCompartment.cs
- UnknownBitmapEncoder.cs
- NetCodeGroup.cs
- WebPartChrome.cs
- BaseAppDomainProtocolHandler.cs
- Mutex.cs
- ComNativeDescriptor.cs
- SafeCryptoHandles.cs
- TimeSpanValidatorAttribute.cs
- CursorEditor.cs
- OdbcErrorCollection.cs
- DebuggerAttributes.cs
- ViewgenContext.cs
- FaultFormatter.cs
- Int64KeyFrameCollection.cs
- IntPtr.cs
- RotateTransform.cs
- Math.cs
- TrackingAnnotationCollection.cs
- CollectionContainer.cs
- ElementFactory.cs
- DbXmlEnabledProviderManifest.cs
- XmlSortKey.cs
- IIS7UserPrincipal.cs
- PrimaryKeyTypeConverter.cs
- PreviewKeyDownEventArgs.cs
- RectValueSerializer.cs
- DataFormat.cs
- IgnoreFlushAndCloseStream.cs
- ConfigXmlComment.cs
- NameValueConfigurationCollection.cs
- XmlIlVisitor.cs
- FormViewUpdateEventArgs.cs
- TaiwanLunisolarCalendar.cs
- ImageBrush.cs
- SqlMethodAttribute.cs
- LogicalExpr.cs
- AddInActivator.cs
- VScrollBar.cs
- DesignSurface.cs
- HistoryEventArgs.cs
- MailAddress.cs
- FixedHyperLink.cs
- PreviewPrintController.cs
- QilIterator.cs
- securitycriticaldataformultiplegetandset.cs
- PixelShader.cs
- PrePrepareMethodAttribute.cs
- ObjectReferenceStack.cs
- DataServiceProviderWrapper.cs
- ProcessHostServerConfig.cs
- ToolStripPanel.cs
- TemplateGroupCollection.cs
- uribuilder.cs
- ControlBuilder.cs
- EncryptedData.cs
- NavigationProgressEventArgs.cs
- AddInSegmentDirectoryNotFoundException.cs
- GridViewDesigner.cs
- DelayedRegex.cs
- DashStyles.cs
- PropertyGridView.cs
- NativeObjectSecurity.cs
- HttpHandlerAction.cs
- CompositeDataBoundControl.cs
- DataSet.cs
- BinaryObjectInfo.cs
- CallbackException.cs
- Visual3D.cs
- FlowPosition.cs
- VirtualizingPanel.cs
- Timer.cs
- OracleLob.cs
- ChangeTracker.cs
- ConfigXmlSignificantWhitespace.cs
- DrawingGroupDrawingContext.cs
- SmiGettersStream.cs
- ClientSession.cs
- PrtCap_Base.cs
- SspiNegotiationTokenProviderState.cs
- StrokeCollection2.cs
- EncryptedPackage.cs
- SocketPermission.cs
- BodyGlyph.cs
- NegatedConstant.cs
- CodeTypeReference.cs
- AnimationStorage.cs
- GridItemPattern.cs
- FontDialog.cs
- MetadataArtifactLoaderCompositeResource.cs