Completed
Last Updated: 26 Jan 2017 10:31 by ADMIN
ADMIN
Dess | Tech Support Engineer, Sr.
Created on: 17 Aug 2016 07:00
Category: GridView
Type: Bug Report
0
FIX. RadGridView - DataRow.RowState is Modified when the cell value is DBNull and the editor is just activated without changing the value
Please refer to the attached sample project. Activate the editor for the "Notes" column of the first row, don't perform any changes and click another row. You will notice that the  DataRow.RowState is Modified although no change is performed. If you perform the same actions with a MS DataGridView, the RowState is not Modified.

Note: the GridViewRowInfo.IsModified property in the CellEndEdit is also set to true without modifying the cell's value. 

Workaround: handle the CellBeginEdit and CellEndEdit events and compare the values before and after the edit operation:

object initialValue = null;

private void radGridView1_CellBeginEdit(object sender, GridViewCellCancelEventArgs e)
{
    initialValue = e.Row.Cells[e.ColumnIndex].Value;
}

private void radGridView1_CellEndEdit(object sender, GridViewCellEventArgs e)
{
    if (initialValue != e.Value)
    {
        Console.WriteLine("modified");
    }
    else
    {
        Console.WriteLine("NOT modified");
    }
}
Attached Files:
(Total attached files size should be smaller than 20mb. Allowed extensions: .zip, .rar, .jpg, .png, .gif)
0 comments