在需要对从表操作的主表的MasterRowExpanded事件这样写:

//展开从表的时的事件


private void gv_Carrier_MasterRowExpanded(object sender, DevExpress.XtraGrid.Views.Grid.CustomMasterRowEventArgs e)    
{ 
          //获取所点击行的从表对象     只要获得这个对象 想做什么操作不用我说了吧 O(∩_∩)O~      
                DevExpress.XtraGrid.Views.Grid.GridView aView = gv_Carrier.GetDetailView(e.RowHandle, e.RelationIndex) as DevExpress.XtraGrid.Views.Grid.GridView; 
                
          if (aView != null)
                {
                        aView.Columns["UID"].Visible = false;    //设置UID 列为隐藏
               aView.Columns["FK_DriverUID"].Visible = false;
          }
}

 

 转载请注明出处  http://www.cnblogs.com/super-cj/archive/2012/06/27/2565874.html