+ if (table == null)
+ return;
+
+ table.Caption = Caption;
+ table.CaptionAlign = CaptionAlign;
+ table.CopyBaseAttributes (this);
+
+ foreach (GridViewRow row in table.Rows) {
+ switch (row.RowType) {
+ case DataControlRowType.Header:
+ if (headerStyle != null && !headerStyle.IsEmpty)
+ row.ControlStyle.MergeWith(headerStyle);
+ row.Visible = ShowHeader;
+ break;
+ case DataControlRowType.Footer:
+ if (footerStyle != null && !footerStyle.IsEmpty)
+ row.ControlStyle.MergeWith (footerStyle);
+ row.Visible = ShowFooter;
+ break;
+ case DataControlRowType.Pager:
+ if (pagerStyle != null && !pagerStyle.IsEmpty)
+ row.ControlStyle.MergeWith (pagerStyle);
+ break;
+ case DataControlRowType.EmptyDataRow:
+ if (emptyDataRowStyle != null && !emptyDataRowStyle.IsEmpty)
+ row.ControlStyle.MergeWith (emptyDataRowStyle);
+ break;
+ case DataControlRowType.DataRow:
+ if ((row.RowState & DataControlRowState.Edit) != 0 && editRowStyle != null && !editRowStyle.IsEmpty)
+ row.ControlStyle.MergeWith (editRowStyle);
+ if ((row.RowState & DataControlRowState.Selected) != 0 && selectedRowStyle != null && !selectedRowStyle.IsEmpty)
+ row.ControlStyle.MergeWith (selectedRowStyle);
+ if ((row.RowState & DataControlRowState.Alternate) != 0 && alternatingRowStyle != null && !alternatingRowStyle.IsEmpty)
+ row.ControlStyle.MergeWith (alternatingRowStyle);
+ if (rowStyle != null && !rowStyle.IsEmpty)
+ row.ControlStyle.MergeWith (rowStyle);
+ break;
+ default:
+ break;
+ }
+
+ foreach (TableCell cell in row.Cells) {
+ DataControlFieldCell fcell = cell as DataControlFieldCell;
+ if (fcell != null) {
+ DataControlField field = fcell.ContainingField;
+ if (field == null)
+ continue;
+ if (!field.Visible) {
+ cell.Visible = false;
+ continue;
+ }
+
+ switch (row.RowType) {
+ case DataControlRowType.Header:
+ if (field.HeaderStyleCreated && !field.HeaderStyle.IsEmpty)
+ cell.ControlStyle.MergeWith (field.HeaderStyle);
+ break;
+ case DataControlRowType.Footer:
+ if (field.FooterStyleCreated && !field.FooterStyle.IsEmpty)
+ cell.ControlStyle.MergeWith (field.FooterStyle);
+ break;
+ default:
+ if (field.ControlStyleCreated && !field.ControlStyle.IsEmpty)
+ foreach (Control c in cell.Controls) {
+ WebControl wc = c as WebControl;
+ if (wc != null)
+ wc.ControlStyle.MergeWith (field.ControlStyle);
+ }
+ if (field.ItemStyleCreated && !field.ItemStyle.IsEmpty)
+ cell.ControlStyle.MergeWith (field.ItemStyle);
+ break;
+ }
+ }
+ }
+ }