コード例 #1
0
ファイル: DetailsView.cs プロジェクト: uQr/referencesource
        /// <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
0
		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
0
		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
0
 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);
 }