首页 > 代码库 > gridControl主子表怎样隐藏子表的列
gridControl主子表怎样隐藏子表的列
private void grvDetail_MasterRowExpanded(object sender, DevExpress.XtraGrid.Views.Grid.CustomMasterRowEventArgs e)
{
DevExpress.XtraGrid.Views.Grid.GridView aView = grvDetail.GetDetailView(e.RowHandle, e.RelationIndex) as DevExpress.XtraGrid.Views.Grid.GridView;
//grvDetail.BeginUpdate();
//this.gridView1.Columns["moid"].Visible = false;
//gridView1.Columns["moid"].OptionsColumn.ShowInCustomizationForm = false;
//grvDetail.EndUpdate();
//DevExpress.XtraGrid.Views.Grid.GridView aView = (DevExpress.XtraGrid.Views.Grid.GridView)gridView1.GetDetailView(e.RowHandle, 0);
if (aView != null)
{
aView.BestFitColumns();
if (aView.Columns.ColumnByFieldName("moid") != null)
{
aView.Columns["moid"].VisibleIndex = -1;
}
}
}
gridControl主子表怎样隐藏子表的列