What is the best way to completely hide a single cell.. (or a selected group of cells)
on certain rows I have fields that will always be null and want to hide the cells completely.
Chears,
Dave
Hi Dave,
Cell has a Hidden property. If you set it true, it will display blank spot in the row. InitializeRow event is probably a good place where you can put code to set this property.
Sandip
I did that with a bunch of trailing checkboxes on partial empty rows:
protected override void InitializeRow(object sender, InitializeRowEventArgs e){ if (e.Row.Cells[cb].Value == DBNull.Value) e.Row.Cells[cb].Style = ColumnStyle.FormattedText;}
Suppose you wants to shows only 2 columns and want to hide rest of columns. Then try this column
Try
Select Case oColumn.Key.ToUpper
Case "Column Name 1"
oColumn.Header.Caption = "Modified Column Name 1"
Case "Column Name 2"
oColumn.Header.Caption = "Modified Column Name 2"
Case Else
oColumn.Hidden = True
End Select
Next
End Try
End Sub