日期:2014-05-16  浏览次数:20418 次

ASPxGridView嵌套,获取子表主键值,求各位指点
周末加班,大清早请教各位了!
通过以下方法绑定了子表信息

        //绑定子表信息
        protected void dxGDSkuCom_DataBinding(object sender, EventArgs e)
        {
            ASPxGridView dd = (ASPxGridView)sender;
            string ItemOuterId = dxTxtItemCode.Text.Trim();
            string SkuId = dd.GetMasterRowFieldValues("Id").ToString();
            
            dd.DataSource = BusinessProtect.BaseInfo.ItemNew.SkuComInfoExecuteDataSet(ItemOuterId, SkuId);
        }


获取主表的选中事件:string OuterId = dxGDSku.GetRowValues(dxGDSku.FocusedRowIndex, "规格编码").ToString();我已经知道了!
现在我想获取被选中的子表某条数据的主键值,怎么获取?请教各位啊!
------解决方案--------------------
引用:
Quote: 引用:

Quote: 引用:

Quote: 引用:

错了,应该是 

ds.Tables["子表名"].Rows[ASPxGridVwQry.FocusedRowIndex]["Id"]


首先谢谢!
可惜这种方法行不通,取主表信息我就是是用你说的这种方法,可以实现:
 string SkuGuid = dxGDSku.GetRowValues(dxGDSku.FocusedRowIndex, "Guid").ToString();


但是取子表信息的话,这种方法实现不了

你页面的Grid是怎么写的?

我用的是DEV控件,下面是ASPxGridView嵌套HTML代码

 <dx:ASPxGridView ID="dxGDSku"  runat="server"  KeyboardSupport="True"  Theme="DevEx" KeyFieldName="ItemOuterId"  AutoGenerateColumns="False" style="width: 100%" ToolTip="规格信息">
                     <Settings  VerticalScrollBarMode="Visible" VerticalScrollableHeight="300"></Settings>
                     <SettingsPager AllButton-Visible="true" AllButton-Text="全部显示" PageSize="50" PageSizeItemSettings-Visible="true" >
                     <AllButton Text="显示全部" Visible="True"></AllButton>
                     <PageSizeItemSettings Visible="True"></PageSizeItemSettings>
                     </SettingsPager>
                    <SettingsBehavior AllowSelectByRowClick="true" ColumnResizeMode="Control" AllowSelectSingleRowOnly="True"  >
                    </SettingsBehavior>
                &nbs