Hi, I am using a RadGridView in which some of the cells might be read-only depending on the values of the data in other columns.
To simulate the read-only behavior, I use «CellBeginEdit» event has recommended in some threads of this forum.
My code looks like this:
private void radGridView_CellBeginEdit(object sender, GridViewCellCancelEventArgs e)
{
e.Cancel = !IsCellUpdatable();
}
The «IsCellUpdatable» function seen above returns true or false depending on if the cell has to be modified.
Up to that part, everything works properly.
The problems I encounter are:
1. Normally, when I leave a cell using the tab key the next cell is entered and it is in edit mode (I mean it has the focus and I can see the cursor). This also works the same way if I leave a cell that is in a column that is read-only. But when I leave a cell in which I simulate the read-only behavior the next cell is not entered in edit mode. This different behavior confuse my users.
2. While adding a new row, normally if I leave the grid my new row (it's data) becomes a standard row and a new empty row is displayed as the new row. But when I leave the grid while I am in a cell for which I simulate the read-only behavior, nothing will happen (the data will stay in the new row) and it looks like the new row has not been added to the list of rows. Again, this behavior is really annoying for the users.
Can you please help me find a way to have read-only cells depending on the value of other columns while maintaining the same behavior for all the cells of the grid.
Thanks for your help,
Alain
To simulate the read-only behavior, I use «CellBeginEdit» event has recommended in some threads of this forum.
My code looks like this:
private void radGridView_CellBeginEdit(object sender, GridViewCellCancelEventArgs e)
{
e.Cancel = !IsCellUpdatable();
}
The «IsCellUpdatable» function seen above returns true or false depending on if the cell has to be modified.
Up to that part, everything works properly.
The problems I encounter are:
1. Normally, when I leave a cell using the tab key the next cell is entered and it is in edit mode (I mean it has the focus and I can see the cursor). This also works the same way if I leave a cell that is in a column that is read-only. But when I leave a cell in which I simulate the read-only behavior the next cell is not entered in edit mode. This different behavior confuse my users.
2. While adding a new row, normally if I leave the grid my new row (it's data) becomes a standard row and a new empty row is displayed as the new row. But when I leave the grid while I am in a cell for which I simulate the read-only behavior, nothing will happen (the data will stay in the new row) and it looks like the new row has not been added to the list of rows. Again, this behavior is really annoying for the users.
Can you please help me find a way to have read-only cells depending on the value of other columns while maintaining the same behavior for all the cells of the grid.
Thanks for your help,
Alain