Hi Telerik,
I got a Radgrid in my project, when i load the data i used Cell Formatting to give some colors by this way.
Then I'm using to validate the cells and to change Fore & back color after the validation, but the color is not changing.
Cell Validated code:
When i put a break point at both cell formatting & cell validated both are clashing each other. How ca i fix this problem, please help me.
I got a Radgrid in my project, when i load the data i used Cell Formatting to give some colors by this way.
private void PrimaryRadGridView_CellFormatting(object sender, CellFormattingEventArgs e) { if (e.CellElement.ColumnInfo.FieldName == "ID") { e.CellElement.DrawFill = true; e.CellElement.NumberOfColors = 1; e.CellElement.BackColor = Color.LightSlateGray; e.CellElement.GradientStyle = GradientStyles.Linear; } if (e.CellElement.ColumnInfo.FieldName == "Type") { e.CellElement.DrawFill = true; e.CellElement.NumberOfColors = 1; e.CellElement.BackColor = Color.LightSlateGray; e.CellElement.GradientStyle = GradientStyles.Linear; } if (e.CellElement.ColumnInfo.FieldName == "BBor") { e.CellElement.DrawFill = true; e.CellElement.NumberOfColors = 1; //e.CellElement.ForeColor = Color.Red; e.CellElement.BackColor = Color.LightGoldenrodYellow; e.CellElement.GradientStyle = GradientStyles.Linear; } if (e.CellElement.ColumnInfo.FieldName == "EBor") { e.CellElement.DrawFill = true; e.CellElement.NumberOfColors = 1; e.CellElement.ForeColor = Color.Red; e.CellElement.BackColor = Color.LightGoldenrodYellow; e.CellElement.GradientStyle = GradientStyles.Linear; } if (e.CellElement.Value != null && e.CellElement.Value.ToString() == "PE0") { e.Row.Cells[4].ReadOnly = true; e.Row.Cells[4].Value = "XXXXXXXXXX"; e.Row.Cells[4].Style.BackColor = Color.DarkRed; e.Row.Cells[4].Style.CustomizeFill = true; } }Then I'm using to validate the cells and to change Fore & back color after the validation, but the color is not changing.
Cell Validated code:
private void PrimaryRadGridView_CellValidated(object sender, CellValidatedEventArgs e) { if (e.ColumnIndex != 3) return; if (e.RowIndex != -1) { int nextRowIndex = e.RowIndex + 1; int lastRowIndex = PrimaryRadGridView.Rows.Count - 1; if (nextRowIndex <= lastRowIndex) { var value = PrimaryRadGridView.Rows[e.RowIndex].Cells[3].Value.ToString(); PrimaryRadGridView.Rows[nextRowIndex].Cells[2].Value = value; PrimaryRadGridView.Rows[nextRowIndex].Cells[2].ReadOnly = true; PrimaryRadGridView.Rows[nextRowIndex].Cells[2].Style.ForeColor = Color.Blue; PrimaryRadGridView.Rows[nextRowIndex].Cells[2].Style.BackColor = Color.GreenYellow; PrimaryRadGridView.Rows[nextRowIndex].Cells[2].Style.CustomizeFill = true; PrimaryRadGridView.ClearSelection(); PrimaryRadGridView.SelectionMode = Telerik.WinControls.UI.GridViewSelectionMode.CellSelect; PrimaryRadGridView.Rows[nextRowIndex].Cells[3].BeginEdit(); PrimaryRadGridView.Rows[nextRowIndex].Cells[2].Style.ForeColor = Color.Blue; PrimaryRadGridView.Rows[nextRowIndex].Cells[3].Style.BackColor = Color.GreenYellow; PrimaryRadGridView.Rows[nextRowIndex].Cells[3].Style.CustomizeFill = true; } } }When i put a break point at both cell formatting & cell validated both are clashing each other. How ca i fix this problem, please help me.