Master - Detail Gridview列隐藏Devexpress

时间:2016-10-26 10:31:33

标签: devexpress master-detail aspxgridview

我有一个多个父子Gridview。问题是父网格视图列名称是成本($),当我展开子网格视图时,($)符号隐藏,当我最小化子网格视图(Devexpress)时将其取回。父子网格视图出现在AspxCallbackPanel和PopupControl中。

<dx:ASPxCallbackPanel ID="cbpCartDetails" runat="server" 
        OnCallback="cbpCartDetails_Callback" ClientInstanceName="cbpCartDetails">
    <ClientSideEvents EndCallback="cbpCartDetails_EndCallBack" />
    <PanelCollection>
    <dx:PanelContent ID="pnlCartDetails">
        <dx:ASPxPopupControl ClientInstanceName="popCartDetails" Width="600px" 
            Height="250px" CloseAction="CloseButton" MaxWidth="800px" MaxHeight="800px" 
            MinHeight="150px" MinWidth="150px" ID="popCartDetails"
            HeaderStyle-ForeColor="White" HeaderStyle-Font-Bold="true"
            runat="server" EnableViewState="false" PopupHorizontalAlign="WindowCenter" 
            PopupVerticalAlign="WindowCenter" EnableHierarchyRecreation="false" 
            Modal="true">
            <ContentCollection>
                <dx:PopupControlContentControl ID="PopupControlContentControl2" 
                                               runat="server">

                    <dx:ASPxGridView ID="grdBuildingCartEst" Width="100%" 
                                     Theme="SoftOrange" KeyFieldName="CarttypeId"
                                     ClientInstanceName="grdBuildingCartEst">
                        <Columns>
                            <dx:GridViewDataTextColumn FieldName="CartType" />
                            <dx:GridViewDataTextColumn FieldName="NumberOfCart" />
                            <dx:GridViewDataTextColumn FieldName="Cost" />
                        </Columns>

                        <Templates>
                            <DetailRow>
                                <dx:ASPxGridView ID="grdFloorsCartEst" 
                                        Width="100%" 
                                        Theme="SoftOrange" 
                                        KeyFieldName="CarttypeId" 
                                        OnInit="grdFloorsCartEst_Init" 
                                        OnBeforePerformDataSelect=
                                           "grdFloorsCartEst_BeforePerformDataSelect" 
                                        ClientInstanceName="grdFloorsCartEst">
                                    <Columns>
                                        <dx:GridViewDataTextColumn 
                                            FieldName="CartSize" />
                                        <dx:GridViewDataTextColumn 
                                            FieldName="NumberOfCart" />
                                        <dx:GridViewDataTextColumn 
                                            FieldName="Cost" />
                                    </Columns>    
                                </dx:ASPxGridView>
                            </DetailRow>
                        </Templates>

                        <SettingsDetail ShowDetailRow="true" />

                    </dx:ASPxGridView>                   
                </dx:PopupControlContentControl>
            </ContentCollection>
        </dx:ASPxPopupControl>
    </dx:PanelContent>
</PanelCollection>

截屏1 https://i.stack.imgur.com/Fb1QX.png

截屏2(错误) https://i.stack.imgur.com/AghdG.png

1 个答案:

答案 0 :(得分:0)

请注意,在您发布的代码中,主网格列没有“Cost($)”字符串,只有FieldName =“Cost”。在Page_Load或其他一些事件中,很可能“Cost($)”在代码隐藏时设置为列标题。

当您展开子网格时,会发生回调,并且不执行设置Cost($)的代码隐藏处的事件代码。因此,您需要确保在子网格扩展回调期间将主网格的列标题设置为“Cost($)”。要100%确定,请将页面/控件的代码隐藏部分发布/附加到问题的文本中。