Code:
/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / ndp / fx / src / xsp / System / Web / UI / WebControls / TemplateColumn.cs / 1 / 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; using System.Security.Permissions; ////// // [AspNetHostingPermission(SecurityAction.LinkDemand, Level=AspNetHostingPermissionLevel.Minimal)] [AspNetHostingPermission(SecurityAction.InheritanceDemand, Level=AspNetHostingPermissionLevel.Minimal)] 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 = " "; } } } } }
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- NavigatingCancelEventArgs.cs
- RegexMatchCollection.cs
- UpdateTracker.cs
- WindowClosedEventArgs.cs
- MenuCommand.cs
- RenderingEventArgs.cs
- XmlReaderSettings.cs
- InnerItemCollectionView.cs
- ExpressionPrefixAttribute.cs
- DataStreamFromComStream.cs
- StylusEventArgs.cs
- Debug.cs
- FreezableCollection.cs
- WebPartEventArgs.cs
- NullableLongAverageAggregationOperator.cs
- InternalMappingException.cs
- ParseHttpDate.cs
- MediaCommands.cs
- PointLightBase.cs
- TraceData.cs
- DynamicValidator.cs
- HeaderLabel.cs
- WebPartPersonalization.cs
- TextTreeTextBlock.cs
- EncryptedPackageFilter.cs
- HWStack.cs
- WebPartAuthorizationEventArgs.cs
- HttpFileCollection.cs
- MessageBuffer.cs
- PerformanceCounterPermissionEntry.cs
- GroupDescription.cs
- SQLString.cs
- WebPartsSection.cs
- NetworkInformationPermission.cs
- TableNameAttribute.cs
- Serializer.cs
- ScriptRegistrationManager.cs
- LineBreakRecord.cs
- CutCopyPasteHelper.cs
- HttpApplicationFactory.cs
- RelationshipSet.cs
- DbExpressionRules.cs
- SystemIcons.cs
- BindingListCollectionView.cs
- MethodAccessException.cs
- ContractSearchPattern.cs
- NavigationWindow.cs
- QueryableDataSourceHelper.cs
- MethodBuilder.cs
- JsonClassDataContract.cs
- NumericPagerField.cs
- XmlBindingWorker.cs
- DataGridAutoGeneratingColumnEventArgs.cs
- FixedHighlight.cs
- ManualResetEvent.cs
- UnsafeNativeMethods.cs
- Timer.cs
- HttpListener.cs
- NaturalLanguageHyphenator.cs
- DataGridViewRowPostPaintEventArgs.cs
- DBConcurrencyException.cs
- RowBinding.cs
- InputProcessorProfilesLoader.cs
- ListViewInsertedEventArgs.cs
- DataGridCell.cs
- ThreadPool.cs
- ResXBuildProvider.cs
- SQLBytes.cs
- KeyboardNavigation.cs
- Panel.cs
- ViewBase.cs
- DbMetaDataCollectionNames.cs
- BamlRecordWriter.cs
- DataListItemCollection.cs
- EpmContentDeSerializerBase.cs
- ConnectionManager.cs
- PersistenceMetadataNamespace.cs
- ReflectionUtil.cs
- ModelVisual3D.cs
- TcpChannelHelper.cs
- XmlObjectSerializerWriteContext.cs
- FillRuleValidation.cs
- PathFigureCollectionValueSerializer.cs
- SelectedPathEditor.cs
- messageonlyhwndwrapper.cs
- tooltip.cs
- ImageAttributes.cs
- DataException.cs
- CollectionChangedEventManager.cs
- StringCollectionMarkupSerializer.cs
- IODescriptionAttribute.cs
- Visual3D.cs
- ErrorProvider.cs
- KeyedCollection.cs
- StylusButton.cs
- SectionVisual.cs
- HandlerWithFactory.cs
- SolidColorBrush.cs
- CompressionTransform.cs
- CommandEventArgs.cs