Loading

DevExpress Grid中点击Detail获得Master rowHandle的方法

最近几日用到DevExpress的Grid,其中又用到Master-Detail。

发现点击Detail中的行,无法获取所属的Master rowHandle,查阅了资料才知道,原来一个属性就可以了。

假设GridControl下有gridview1,gridview2,其中gridview1是master,gridview2是child。那么语句如下:

 

private void gridView2_GotFocus(object sender, EventArgs e)
{
//MessageBox.Show("ddd");
DevExpress.XtraGrid.Views.Grid.GridView gv = (DevExpress.XtraGrid.Views.Grid.GridView)gridControl1.FocusedView;
int rowHandle = gv.SourceRowHandle;
gridView1.FocusedRowHandle = rowHandle;
//FocusedRowHandle
}
posted @ 2012-08-02 01:14  jevan  阅读(1313)  评论(0编辑  收藏  举报