or
Dim OrderLinesTemplate As New GridViewTemplate OrderLinesTemplate.AllowAddNewRow = False OrderLinesTemplate.DataSource = myOrderLines OrderLinesTemplate.Columns(0).Width = 100 OrderLinesTemplate.Columns(1).Width = 200 OrderLinesTemplate.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.None Me.RadGridView1.MasterTemplate.Templates.Add(OrderLinesTemplate)Private Sub RadGridView1_ViewCellFormatting(sender As Object, e As Telerik.WinControls.UI.CellFormattingEventArgs) Handles RadGridView1.ViewCellFormatting If TypeOf e.CellElement Is GridDetailViewCellElement Then e.CellElement.BorderWidth = 10 e.CellElement.AutoSize = False e.CellElement.Size = New System.Drawing.Size(350, 150) End If End SuballDataCells = 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