System.Web.UI.WebControls.GridView.InitializeRow C# (CSharp) Method

InitializeRow() protected method

protected InitializeRow ( GridViewRow row, DataControlField fields ) : void
row GridViewRow
fields DataControlField
return void
		protected virtual void InitializeRow (GridViewRow row, DataControlField[] fields)
		{
			DataControlCellType ctype;
			bool accessibleHeader = false;

			switch (row.RowType) {
			case DataControlRowType.Header:
				ctype = DataControlCellType.Header; 
				accessibleHeader = UseAccessibleHeader;
				break;
			case DataControlRowType.Footer:
				ctype = DataControlCellType.Footer;
				break;
			default:
				ctype = DataControlCellType.DataCell;
				break;
			}
			
			for (int n=0; n<fields.Length; n++) {
				DataControlField field = fields [n];
				
				DataControlFieldCell cell;
				if (((field is BoundField) && ((BoundField)field).DataField == RowHeaderColumn) || accessibleHeader)
					cell = new DataControlFieldHeaderCell (field, accessibleHeader ? TableHeaderScope.Column : TableHeaderScope.Row);
				else
					cell = new DataControlFieldCell (field);
				row.Cells.Add (cell);
				field.InitializeCell (cell, ctype, row.RowState, row.RowIndex);
			}
		}