Hello Marco,
The
ValueChanged event will fire every time you change the value in a cell, but that value will not be applied in the cell until you move from that cell, because it is waiting for confirmation, you could always cancel the operation, or change the value.
That's why when you move out of that cell, and the value has been changed, the
CellValueChanged event will fire, and the value will be changed.
You can change this behavior by registering to the
ValueChanged event and using this:
I will also attach a full example in the following lines, if you need it:
using
System;
using
System.Collections.Generic;
using
System.Diagnostics;
using
System.Windows.Forms;
using
Telerik.WinControls.UI;
public
partial
class
Form1 : Form
{
private
RadGridView radGridView1;
public
Form1()
{
InitializeComponent();
this
.Controls.Add(radGridView1 =
new
RadGridView());
radGridView1.Dock = DockStyle.Fill;
radGridView1.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill;
var list =
new
List<Test>();
for
(
int
i = 0; i < 10; i++)
{
list.Add(
new
Test { Id = i, Checked = i % 2 == 0 });
}
radGridView1.ValueChanged +=
new
EventHandler(radGridView1_ValueChanged);
radGridView1.CellValueChanged +=
new
GridViewCellEventHandler(radGridView1_CellValueChanged);
radGridView1.DataSource = list;
}
void
radGridView1_CellValueChanged(
object
sender, GridViewCellEventArgs e)
{
Debug.WriteLine(
"CellValueChanged"
);
}
void
radGridView1_ValueChanged(
object
sender, EventArgs e)
{
Debug.WriteLine(
"ValueChanged"
);
radGridView1.EndEdit();
//radGridView1.BeginEdit();
}
}
public
class
Test
{
public
int
Id {
get
;
set
; }
public
bool
Checked {
get
;
set
; }
}
Hope this helps, if you have any other questions or comments, please let me know,
Best Regards,
Emanuel Varga