or
allDataCells =
true
;
foreach
(GridViewCellInfo cell
in
commandGridView.SelectedCells)
{
if
(cell.ColumnInfo.Name !=
"columnData"
)
{
allDataCells =
false
;
break
;
}
}
It bugs me that I'm using the text name rather than the actual column variable. I know, in my example scenario, that the column variable is actually "gridViewTextBoxColumn8" (which could be a better name, I know).
Other than comparing on the name variables, which is a little better:
gridViewTextBoxColumn8.Name == cell.ColumnInfo.Name
...is there a "good" way to do this? When given a GridViewCellInfo item, what's the type-safe and typo-safe way to compare the column?
Thanks!
Dave
SaveFileDialog saveDialog = new SaveFileDialog(); |
saveDialog.DefaultExt = "xls"; |
saveDialog.Filter = "Excel (*.xls)|*.xls"; |
saveDialog.OverwritePrompt = true; |
saveDialog.CreatePrompt = true; |
if (saveDialog.ShowDialog() == DialogResult.OK) |
{ |
if (string.IsNullOrEmpty(saveDialog.FileName)) |
{ |
MessageBox.Show("Please enter a file name."); |
return; |
} |
ExportToExcelML export = new ExportToExcelML(); |
export.HiddenColumnOption = ExportToExcelML.HiddenOption.ExportAsHidden; |
export.HiddenRowOption = ExportToExcelML.HiddenOption.ExportAsHidden; |
export.RunExport(bestellungRadGridView, saveDialog.FileName, ExportToExcelML.ExcelMaxRows._65536, true); |
} |
ConditionalFormattingObject c2 =
new
ConditionalFormattingObject(
"Test_A"
, ConditionTypes.Equal,
"true"
, String.Empty,
true
);
c2.CellForeColor =
c2.RowForeColor = Color.Blue;
gdvAuditoria2.Columns[NomesColunasGridAuditoria.Validar].ConditionalFormattingObjectList.Add(c2);
gdvAuditoria2.Columns[NomesColunasGridAuditoria.Rejeitar].ConditionalFormattingObjectList.Add(c2);
ConditionalFormattingObject c3 =
new
ConditionalFormattingObject(
"Test_
B"
, ConditionTypes.Equal, String.Empty, String.Empty,
true
);
c3.CellForeColor =
c3.RowForeColor = Color.Black;
gdvAuditoria2.Columns[NomesColunasGridAuditoria.CodAuditoria].ConditionalFormattingObjectList.Add(c3);
ConditionalFormattingObject c1 =
new
ConditionalFormattingObject(
"Test_
C"
, ConditionTypes.Equal,
"true"
, String.Empty,
true
);
c1.CellForeColor =
c1.RowForeColor = Color.Red;
gdvAuditoria2.Columns[NomesColunasGridAuditoria.Substituido].ConditionalFormattingObjectList.Add(c1);
More formatting that is being changed only when changing line.
How can I do to change a value after a row with checkbox that formatting is applied?
Marcelo