如何禁用 GridView 中的列?
How to disable column in GridView?
我想禁用 DevExpress 中的列 detailView in GridView。现在我可以通过以下代码隐藏此视图中的列,但我无法将这些列设置为只读或未启用:
private void GridView_MasterRowExpanded(object sender, CustomMasterRowEventsArgs e)
{
var masterView = sender as GridView;
GridView detailView = masterView?.GetDetailView(e.RowHandle, e.RelationIndex) as GridView;
detailView?.Columns[0].Visible = false;
}
private void GridView_MasterRowExpanded(object sender, CustomMasterRowEventsArgs e)
{
var masterView = sender as GridView;
GridView detailView = masterView?.GetDetailView(e.RowHandle, e.RelationIndex) as GridView;
//Make the column read-only
detailView?.Columns[0].OptionsColumn.ReadOnly = true;
//Make the column non-editable
detailView?.Columns[0].OptionsColumn.AllowEdit = false;
}
我想禁用 DevExpress 中的列 detailView in GridView。现在我可以通过以下代码隐藏此视图中的列,但我无法将这些列设置为只读或未启用:
private void GridView_MasterRowExpanded(object sender, CustomMasterRowEventsArgs e)
{
var masterView = sender as GridView;
GridView detailView = masterView?.GetDetailView(e.RowHandle, e.RelationIndex) as GridView;
detailView?.Columns[0].Visible = false;
}
private void GridView_MasterRowExpanded(object sender, CustomMasterRowEventsArgs e)
{
var masterView = sender as GridView;
GridView detailView = masterView?.GetDetailView(e.RowHandle, e.RelationIndex) as GridView;
//Make the column read-only
detailView?.Columns[0].OptionsColumn.ReadOnly = true;
//Make the column non-editable
detailView?.Columns[0].OptionsColumn.AllowEdit = false;
}