GridControl中设置某个单元格不可编辑

GridControl中设置某个单元格不可编辑
对于绑定控件和不绑定控件都有效。因为不绑定控件默认的是文本编辑器。
参考代码示例:

private void gridView1_ShowingEditor(object sender, CancelEventArgs e)
{
	if (gridView1.FocusedColumn.FieldName == "PickListID")
	{
		int row = this.gridView1.FocusedRowHandle;
		if (row >=0)
		{
			if (gridView1.GetRowCellValue(row, "IsPickListEditable") != null)
			{
				if ((bool)gridView1.GetRowCellValue(row, "IsPickListEditable") == false)
				{
					e.Cancel = true;//该行不可编辑
				}
			}
		}
	}
}

posted on 2023-02-13 17:35  因思道客  阅读(629)  评论(0)    收藏  举报

导航