or
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
;
}
}
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
;
}
}
}
Me.RadGridView1.TableElement.ScrollTo(0, 0)
I hate spending hours on something that is probably very easy ! It must be something I am doing to clear the Grid and repopulate it.. but haven't managed to find it!.
Any hints / thoughts?
Thanks
Rob
GridViewComboBoxColumn MemberColumn =
new
GridViewComboBoxColumn();
MemberColumn.Name =
"MemberColumn"
;
MemberColumn.HeaderText =
"Member"
;
MemberColumn.DataSource = ctx.Members;
MemberColumn.ValueMember =
"MemberID"
;
MemberColumn.DisplayMember =
"MemberName"
;
MemberColumn.FieldName =
"MemberID"
;
this
.ResultGridView.Columns.Add(MemberColumn);