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

InitializeRow() protected method

protected InitializeRow ( FormViewRow row ) : void
row FormViewRow
return void
		protected virtual void InitializeRow (FormViewRow row)
		{
			TableCell cell = new TableCell ();
			
			if (row.RowType == DataControlRowType.DataRow)
			{
				if ((row.RowState & DataControlRowState.Edit) != 0) {
					if (editItemTemplate != null)
						editItemTemplate.InstantiateIn (cell);
					else
						row.Visible = false;
				} else if ((row.RowState & DataControlRowState.Insert) != 0) {
					if (insertItemTemplate != null)
						insertItemTemplate.InstantiateIn (cell);
					else
						row.Visible = false;
				}
				else if (itemTemplate != null)
					itemTemplate.InstantiateIn (cell);
				else
					row.Visible = false;
			}
			else if (row.RowType == DataControlRowType.EmptyDataRow)
			{
				if (emptyDataTemplate != null)
					emptyDataTemplate.InstantiateIn (cell);
				else if (!String.IsNullOrEmpty (EmptyDataText))
					cell.Text = EmptyDataText;
				else
					row.Visible = false;
			}
			else if (row.RowType == DataControlRowType.Footer)
			{
				if (footerTemplate != null)
					footerTemplate.InstantiateIn (cell);
				else if (!String.IsNullOrEmpty (FooterText))
					cell.Text = FooterText;
				else
					row.Visible = false;
			}
			else if (row.RowType == DataControlRowType.Header)
			{
				if (headerTemplate != null)
					headerTemplate.InstantiateIn (cell);
				else if (!String.IsNullOrEmpty (HeaderText))
					cell.Text = HeaderText;
				else
					row.Visible = false;
			}
			cell.ColumnSpan = 2;
			row.Cells.Add (cell);
		}