本文整理汇总了C#中System.Web.UI.WebControls.DataControlField.InitializeCell方法的典型用法代码示例。如果您正苦于以下问题:C# DataControlField.InitializeCell方法的具体用法?C# DataControlField.InitializeCell怎么用?C# DataControlField.InitializeCell使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Web.UI.WebControls.DataControlField
的用法示例。
在下文中一共展示了DataControlField.InitializeCell方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InitializeRow
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
protected virtual void InitializeRow(DetailsViewRow row, DataControlField field) {
TableCellCollection cells = row.Cells;
DataControlFieldCell contentCell = new DataControlFieldCell(field);
ITemplate contentTemplate = null;
int itemIndex = DataItemIndex;
DataControlRowState rowState = row.RowState;
switch (row.RowType) {
case DataControlRowType.DataRow:
if (field.ShowHeader) {
DataControlFieldCell headerTextCell = new DataControlFieldCell(field);
field.InitializeCell(headerTextCell, DataControlCellType.Header, rowState, itemIndex);
cells.Add(headerTextCell);
}
else {
contentCell.ColumnSpan = 2;
}
field.InitializeCell(contentCell, DataControlCellType.DataCell, rowState, itemIndex);
break;
case DataControlRowType.Header:
contentTemplate = _headerTemplate;
contentCell.ColumnSpan = 2;
string headerText = HeaderText;
if (_headerTemplate == null && headerText.Length > 0) {
contentCell.Text = headerText;
}
break;
case DataControlRowType.Footer:
contentTemplate = _footerTemplate;
contentCell.ColumnSpan = 2;
string footerText = FooterText;
if (_footerTemplate == null && footerText.Length > 0) {
contentCell.Text = footerText;
}
break;
case DataControlRowType.EmptyDataRow:
contentTemplate = _emptyDataTemplate;
string emptyDataText = EmptyDataText;
if (_emptyDataTemplate == null && emptyDataText.Length > 0) {
contentCell.Text = emptyDataText;
}
break;
}
if (contentTemplate != null) {
contentTemplate.InstantiateIn(contentCell);
}
cells.Add(contentCell);
}
示例2: InitializeRow
protected virtual void InitializeRow (DetailsViewRow row, DataControlField field)
{
if (!field.Visible) {
row.Visible = false;
return;
}
row.ContainingField = field;
DataControlFieldCell cell;
if (field.ShowHeader) {
cell = new DataControlFieldCell (field);
row.Cells.Add (cell);
field.InitializeCell (cell, DataControlCellType.Header, row.RowState, row.RowIndex);
}
cell = new DataControlFieldCell (field);
if (!field.ShowHeader)
cell.ColumnSpan = 2;
row.Cells.Add (cell);
field.InitializeCell (cell, DataControlCellType.DataCell, row.RowState, row.RowIndex);
if (CurrentMode == DetailsViewMode.Insert && !field.InsertVisible)
row.Visible = false;
}
示例3: InitializeRow
protected virtual void InitializeRow (DetailsViewRow row, DataControlField field)
{
DataControlFieldCell cell;
if (field.ShowHeader) {
cell = new DataControlFieldCell (field);
row.Cells.Add (cell);
field.InitializeCell (cell, DataControlCellType.Header, row.RowState, row.RowIndex);
}
cell = new DataControlFieldCell (field);
if (!field.ShowHeader)
cell.ColumnSpan = 2;
row.Cells.Add (cell);
field.InitializeCell (cell, DataControlCellType.DataCell, row.RowState, row.RowIndex);
}
示例4: InitializeRow
protected virtual void InitializeRow(DetailsViewRow row, DataControlField field)
{
TableCellCollection cells = row.Cells;
DataControlFieldCell cell = new DataControlFieldCell(field);
ITemplate template = null;
int dataItemIndex = this.DataItemIndex;
DataControlRowState rowState = row.RowState;
switch (row.RowType)
{
case DataControlRowType.Header:
{
template = this._headerTemplate;
cell.ColumnSpan = 2;
string headerText = this.HeaderText;
if ((this._headerTemplate == null) && (headerText.Length > 0))
{
cell.Text = headerText;
}
goto Label_0116;
}
case DataControlRowType.Footer:
{
template = this._footerTemplate;
cell.ColumnSpan = 2;
string footerText = this.FooterText;
if ((this._footerTemplate == null) && (footerText.Length > 0))
{
cell.Text = footerText;
}
goto Label_0116;
}
case DataControlRowType.DataRow:
{
if (!field.ShowHeader)
{
cell.ColumnSpan = 2;
break;
}
DataControlFieldCell cell2 = new DataControlFieldCell(field);
field.InitializeCell(cell2, DataControlCellType.Header, rowState, dataItemIndex);
cells.Add(cell2);
break;
}
case DataControlRowType.EmptyDataRow:
{
template = this._emptyDataTemplate;
string emptyDataText = this.EmptyDataText;
if ((this._emptyDataTemplate == null) && (emptyDataText.Length > 0))
{
cell.Text = emptyDataText;
}
goto Label_0116;
}
default:
goto Label_0116;
}
field.InitializeCell(cell, DataControlCellType.DataCell, rowState, dataItemIndex);
Label_0116:
if (template != null)
{
template.InstantiateIn(cell);
}
cells.Add(cell);
}