Give a grid with multiple columns. How can I hide column that has no value?
I ve tryed something like this :
protected
void
RG_Import_PreRender(
object
sender, EventArgs e)
{
foreach
(GridColumn col
in
RG_Import.Columns)
{
bool
valueFound =
false
;
foreach
(var row
in
RG_Import.Rows)
{
var cell = row.Cells[col.Name].Value;
if
(cell !=
null
&& cell != DBNull.Value && !
string
.IsNullOrWhiteSpace(cell))
{
valueFound =
true
;
break
;
}
}
col.Visible = valueFound;
}
}