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
- ConnectionManagementElement.cs
- EventHandlersStore.cs
- IUnknownConstantAttribute.cs
- ThreadAttributes.cs
- MergeFailedEvent.cs
- TraceInternal.cs
- updatecommandorderer.cs
- SchemaDeclBase.cs
- UserControl.cs
- RegexBoyerMoore.cs
- ListSortDescriptionCollection.cs
- ByteStreamGeometryContext.cs
- _BufferOffsetSize.cs
- ConsumerConnectionPoint.cs
- ToolboxCategoryItems.cs
- EncryptedKeyIdentifierClause.cs
- XmlSchemaObjectCollection.cs
- OutOfMemoryException.cs
- MenuAdapter.cs
- VectorConverter.cs
- DataGridViewTextBoxColumn.cs
- WebBrowserPermission.cs
- HwndSourceKeyboardInputSite.cs
- TrackingAnnotationCollection.cs
- DPTypeDescriptorContext.cs
- HttpPostedFile.cs
- SqlTriggerAttribute.cs
- DataContractSerializer.cs
- WebBaseEventKeyComparer.cs
- TextDecoration.cs
- MethodToken.cs
- SqlTypesSchemaImporter.cs
- Hashtable.cs
- NodeInfo.cs
- DateTimeParse.cs
- TdsParameterSetter.cs
- Win32SafeHandles.cs
- DesigntimeLicenseContext.cs
- XmlNamespaceManager.cs
- CustomGrammar.cs
- RoutedEventHandlerInfo.cs
- ToggleButton.cs
- SqlGatherConsumedAliases.cs
- ControlBindingsCollection.cs
- ToolStripPanelRenderEventArgs.cs
- OdbcConnectionStringbuilder.cs
- HtmlInputPassword.cs
- OracleColumn.cs
- KeyValueInternalCollection.cs
- ArgumentNullException.cs
- TranslateTransform.cs
- QilSortKey.cs
- MouseWheelEventArgs.cs
- UpDownEvent.cs
- ImageIndexConverter.cs
- SignatureDescription.cs
- InstanceData.cs
- ExpressionVisitor.cs
- DebugView.cs
- DebugView.cs
- NavigatingCancelEventArgs.cs
- HttpListener.cs
- DbException.cs
- SoapTypeAttribute.cs
- Camera.cs
- SynchronizedInputHelper.cs
- _ProxyRegBlob.cs
- NullableIntAverageAggregationOperator.cs
- ToolStripSeparatorRenderEventArgs.cs
- LinkedList.cs
- PngBitmapDecoder.cs
- CustomErrorCollection.cs
- ComponentChangedEvent.cs
- HtmlGenericControl.cs
- TypeGeneratedEventArgs.cs
- Message.cs
- sortedlist.cs
- StateFinalizationActivity.cs
- DeleteMemberBinder.cs
- XsltConvert.cs
- DelegateBodyWriter.cs
- AutoResetEvent.cs
- QueryParameter.cs
- CachedPathData.cs
- HandleTable.cs
- ConfigXmlComment.cs
- TypeHelpers.cs
- Debug.cs
- SR.cs
- CheckBoxField.cs
- TraceContextEventArgs.cs
- Brush.cs
- Expression.cs
- QualificationDataItem.cs
- AppSettingsExpressionBuilder.cs
- SmiXetterAccessMap.cs
- HyperLinkDesigner.cs
- NonClientArea.cs
- WebServiceParameterData.cs
- SchemaObjectWriter.cs