Files
mono/mcs/class/System.Web/System.Web.UI.WebControls/TemplateColumn.cs
T
Andreas N be498b8f43 2003-07-30 Andreas Nahr <[email protected]>
* RequiredFieldValidator.cs: Added all attributes
	* Style.cs: Added all attributes
	* Table.cs: Added all attributes
	* TableCell.cs: Added all attributes, added error checks, throws more exceptions
	* TableCellCollection.cs: Added attribute
	* TableRow.cs: Added all attributes
	* TableRowCollection: Added attribute
	* TableStyle.cs: Added all attributes, improved error messages
	* TemplateColumn.cs: Added all attributes
	* TextBox.cs: Added all attributes, added error checks, throws more exceptions
	* ValidationSummary.cs: Added all attributes
	* WebControl.cs: Added all attributes
	* Xml.cs: Added all attributes

svn path=/trunk/mcs/; revision=16907
2003-07-30 18:18:28 +00:00

122 lines
3.1 KiB
C#

//
// System.Web.UI.WebControls.TemplateColumn.cs
//
// Authors:
// Gaurav Vaish ([email protected])
// Andreas Nahr ([email protected])
//
// (C) Gaurav Vaish (2002)
// (C) 2003 Andreas Nahr
//
using System;
using System.ComponentModel;
using System.Web;
using System.Web.UI;
namespace System.Web.UI.WebControls
{
public class TemplateColumn : DataGridColumn
{
private ITemplate editItemTemplate;
private ITemplate footerTemplate;
private ITemplate headerTemplate;
private ITemplate itemTemplate;
public TemplateColumn(): base()
{
}
[DefaultValue (null), Browsable (false)]
[PersistenceMode (PersistenceMode.InnerProperty), TemplateContainer (typeof (DataGridItem))]
[WebSysDescription ("The template that is used to build that are being edited rows for this column.")]
public virtual ITemplate EditItemTemplate
{
get
{
return editItemTemplate;
}
set
{
editItemTemplate = value;
OnColumnChanged();
}
}
[DefaultValue (null), Browsable (false)]
[PersistenceMode (PersistenceMode.InnerProperty), TemplateContainer (typeof (DataGridItem))]
[WebSysDescription ("The template that is used to build the footer for this column.")]
public virtual ITemplate FooterTemplate
{
get
{
return footerTemplate;
}
set
{
footerTemplate = value;
OnColumnChanged();
}
}
[DefaultValue (null), Browsable (false)]
[PersistenceMode (PersistenceMode.InnerProperty), TemplateContainer (typeof (DataGridItem))]
[WebSysDescription ("The template that is used to build the header for this column.")]
public virtual ITemplate HeaderTemplate
{
get
{
return headerTemplate;
}
set
{
headerTemplate = value;
OnColumnChanged();
}
}
[DefaultValue (null), Browsable (false)]
[PersistenceMode (PersistenceMode.InnerProperty), TemplateContainer (typeof (DataGridItem))]
[WebSysDescription ("The template that is used to build rows for this column.")]
public virtual ITemplate ItemTemplate
{
get
{
return itemTemplate;
}
set
{
itemTemplate = value;
OnColumnChanged();
}
}
public override void InitializeCell(TableCell cell, int columnIndex, ListItemType itemType)
{
base.InitializeCell(cell, columnIndex, itemType);
ITemplate toRender = null;
switch(itemType)
{
case ListItemType.Header: toRender = headerTemplate;
break;
case ListItemType.Footer: toRender = footerTemplate;
break;
case ListItemType.Item: toRender = itemTemplate;
break;
case ListItemType.AlternatingItem: toRender = itemTemplate;
break;
case ListItemType.SelectedItem: toRender = editItemTemplate;
break;
default: toRender = editItemTemplate;
break;
}
if(toRender != null)
{
cell.Text = String.Empty;
toRender.InstantiateIn(cell);
}
}
}
}