Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / 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 = " "; } } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ //// 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 = " "; } } } } } // 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
- ViewManager.cs
- HandleCollector.cs
- QilList.cs
- ClientBuildManagerTypeDescriptionProviderBridge.cs
- DES.cs
- MaxMessageSizeStream.cs
- SemanticValue.cs
- ResourcesChangeInfo.cs
- Tile.cs
- WebBrowsableAttribute.cs
- DBCommandBuilder.cs
- XsdDuration.cs
- ListBoxChrome.cs
- _SafeNetHandles.cs
- ItemList.cs
- XmlSchemaCollection.cs
- XDRSchema.cs
- XPathItem.cs
- DeferrableContentConverter.cs
- LayoutDump.cs
- WebRequestModulesSection.cs
- TreeNode.cs
- HostingEnvironmentSection.cs
- Translator.cs
- ArrayItemValue.cs
- EntityDataSourceValidationException.cs
- CommandValueSerializer.cs
- ReadOnlyHierarchicalDataSource.cs
- Math.cs
- Binding.cs
- InputLangChangeEvent.cs
- AssemblyBuilder.cs
- ReaderWriterLockWrapper.cs
- RenderTargetBitmap.cs
- SingleAnimationUsingKeyFrames.cs
- TextEndOfLine.cs
- CannotUnloadAppDomainException.cs
- TabControlAutomationPeer.cs
- OdbcCommand.cs
- DuplexChannel.cs
- ContentWrapperAttribute.cs
- FlatButtonAppearance.cs
- ConnectionProviderAttribute.cs
- WhitespaceRule.cs
- SettingsPropertyIsReadOnlyException.cs
- DeviceFiltersSection.cs
- DelimitedListTraceListener.cs
- WmlControlAdapter.cs
- SpellerInterop.cs
- StateChangeEvent.cs
- WindowsGraphicsCacheManager.cs
- PointAnimationBase.cs
- UniqueIdentifierService.cs
- InheritanceContextHelper.cs
- ExceptionHandler.cs
- ScrollViewerAutomationPeer.cs
- SystemUnicastIPAddressInformation.cs
- VarInfo.cs
- ConfigXmlAttribute.cs
- AttributeUsageAttribute.cs
- EDesignUtil.cs
- ParseNumbers.cs
- MetadataFile.cs
- StringSource.cs
- CookielessHelper.cs
- CoTaskMemHandle.cs
- ComponentSerializationService.cs
- ReadWriteSpinLock.cs
- Cursors.cs
- ProviderConnectionPoint.cs
- XamlToRtfWriter.cs
- ExtensionWindowHeader.cs
- StrokeNodeOperations2.cs
- Point3DValueSerializer.cs
- EventMappingSettingsCollection.cs
- RowCache.cs
- _ProxyChain.cs
- VisualStates.cs
- Random.cs
- ListBoxItem.cs
- _PooledStream.cs
- xmlsaver.cs
- Processor.cs
- CommonGetThemePartSize.cs
- NavigationPropertySingletonExpression.cs
- FrameworkContentElement.cs
- JsonGlobals.cs
- PropertyGridEditorPart.cs
- ToolStripDropDownItem.cs
- HelpKeywordAttribute.cs
- DES.cs
- UInt64Storage.cs
- QualificationDataAttribute.cs
- HwndMouseInputProvider.cs
- TextTreeUndo.cs
- VerificationException.cs
- WebPartTransformerAttribute.cs
- AutomationElementIdentifiers.cs
- ZipIOFileItemStream.cs
- WebPartHelpVerb.cs