首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >GridLookUpEdit和多部分密钥

GridLookUpEdit和多部分密钥
EN

Stack Overflow用户
提问于 2011-11-17 03:03:31
回答 1查看 1.6K关注 0票数 0

我意识到DevExpress GridLookUpEdit编辑器并不是为处理具有多部分键的数据而设计的。但是,无论如何我都在尝试解决这个限制。

我的GridLookUpEdit的数据是Product-Purity,有两列"PRODUCT_ID“和"PURITY_ID”。当用户在GridLookupEdit中选择product-purity行时,我使用以下代码设置底层网格的纯度:

代码语言:javascript
复制
    void lookUpEditProductPurities_EditValueChanged(object sender, EventArgs e)
    {
        // Get the purity from the product selected and update the purity column of the grid.
        DevExpress.XtraEditors.GridLookUpEdit editor = (sender as DevExpress.XtraEditors.GridLookUpEdit);
        DevExpress.XtraGrid.Views.Grid.GridView view = editor.Properties.View as DevExpress.XtraGrid.Views.Grid.GridView;
        object val = view.GetRowCellValue(view.FocusedRowHandle, "PURITY_ID");
        if (editor.Parent is GridControl)
        {
            GridControl ParentGridControl = (editor.Parent as GridControl);
            GridView ParentGridView = (ParentGridControl.MainView as GridView);
            DataRow CurrentDataRow = ParentGridView.GetDataRow(ParentGridView.FocusedRowHandle);
            CurrentDataRow["PRODUCT_PURITY_ID"] = val;
        }
    }

当我在主网格中使用它时,它工作得很好,但有一个小问题。当现有行引用的纯度不是产品的第一纯度时,弹出网格将使其看起来就像选择了第一纯度一样。在我看来,这不是什么大问题。

但是:我遇到的一个大问题是,当我在主-细节网格的细节行中使用这个GridLookUpEdit时。调用: editor.Parent返回主节点的网格控制,ParentGridControl.MainView返回主节点的GridView。

如何获取GridLookUpEdit作为编辑器的gridView -子gridView??

蒂娅-

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2011-11-17 13:09:33

您的任务(获取详细视图)可以使用What can cause the properties, methods, and events of a detail grid view to fail?文章中所示的方法--使用GridView.GetDetailView方法来实现。

另请查看以下文章:Navigating Through Master and Detail Rows

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/8157181

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档