It seems that in the SaveCellInfo event, in the case where I am pasting cells that I copied from elsewhere in the grid, the GridSaveCellInfoEventArgs are actually describing the copied cells, not the cells I am setting. For example, hook the code below to a grid (virtual grid using QueryCellInfo) which is working fine, and has some read-only cells and some read-write cells. In such case, copy some read-write cells and paste over read-only cells, it allows it. However copy some read-only cells, paste them over some read-write cells, it prevents it. Why??
private void grid_SaveCellInfo(object sender, Syncfusion.Windows.Forms.Grid.GridSaveCellInfoEventArgs e)
{
System.Diagnostics.Debug.WriteLine(String.Format("SaveCellInfo({0},{1}) Readonly={2}", e.RowIndex, e.ColIndex, e.Style.ReadOnly));
if ( !e.Style.ReadOnly )
{
PropertyDescriptor p = _settings.Columns[e.ColIndex-1].PropertyDescriptor;
DataboundRow row = _rows[e.RowIndex-1];
p.SetValue(row, e.Style.Text);
}
e.Handled = true;
}
AD
Administrator
Syncfusion Team
August 9, 2004 12:57 PM UTC
Unless I am missing something, I think your code is working as expected.
>>In such case, copy some read-write cells and paste over read-only cells, it allows it.
In such a case, e.Style.ReadOnly would be false, correct? So, your code sets the value.
>>However copy some read-only cells, paste them over some read-write cells, it prevents it. Why??
In this case, e.StyleReadOnly = true, correct? So, you code does not set the value.