码迷,mamicode.com
首页 > Web开发 > 详细

DEVexpress控件使用 ASPxGridView 制作报表带子表的 备忘

时间:2018-11-24 19:00:27      阅读:216      评论:0      收藏:0      [点我收藏+]

标签:header   family   style   设置   code   temp   skin   set   序号   

利用ASPxGridView制作报表

                <dx:ASPxGridView ID="grdProductivity" runat="server" AutoGenerateColumns="False" KeyFieldName="Work_Cell_Code" SkinID="ASPxGridViewSkin"
                    OnDetailRowExpandedChanged="grdProductivity_DetailRowExpandedChanged"    //子表展开时触发
                    OnCustomUnboundColumnData="grdProductivity_OnCustomUnboundColumnData"    //动态序号添加
                    OnPageIndexChanged="grdProductivity_OnPageIndexChanged"
                    OnPageSizeChanged="grdProductivity_OnPageSizeChanged"
                    OnBeforeColumnSortingGrouping="grdProductivity_OnBeforeColumnSortingGrouping"   //点击列排序  发生拖拽时触发
                    OnCustomColumnGroup="grdProductivity_OnCustomColumnGroup"
                    OnCustomColumnSort="grdProductivity_OnCustomColumnSort">
                    <Columns>
                        <dx:GridViewDataTextColumn VisibleIndex="0" Caption="序号" FieldName="hh" UnboundType="Integer" Name="hh" Width="5px">
                        </dx:GridViewDataTextColumn>
                        <dx:GridViewDataTextColumn VisibleIndex="1" FieldName="Production_Line_Desc" Caption="生产线名称">
                        </dx:GridViewDataTextColumn>
                    </Columns>
                    <Styles>
                        <Header ForeColor="#697a8a" Font-Bold="True" Font-Size="15px" BackColor="#EFF2F7" Border-BorderColor="#e3eae7"></Header>
                    </Styles>
                    <SettingsDetail ShowDetailRow="True"></SettingsDetail>
                    <Templates>
                        <DetailRow>
                            <dx:ASPxGridView runat="server" ID="gv_detail" AutoGenerateColumns="false" SkinID="DetailASPxGridViewSkin" OnCustomUnboundColumnData="gv_detail_OnCustomUnboundColumnData">
                                <Columns>
                                    <dx:GridViewDataTextColumn VisibleIndex="0" FieldName="hh" Caption="序号" UnboundType="Integer" Name="hh" Width="5px">
                                    </dx:GridViewDataTextColumn>
                                    <dx:GridViewDataTextColumn VisibleIndex="1" FieldName="Production_Line_Desc" Caption="生产线名称">
                                    </dx:GridViewDataTextColumn> 
                                </Columns>
                            </dx:ASPxGridView>
                        </DetailRow>
                    </Templates>
                </dx:ASPxGridView>
                <dx:ASPxGridViewExporter ID="dxgvExport" runat="server" GridViewID="grdProductivity"></dx:ASPxGridViewExporter>  / /导出到xlsx
 
主子表:报表
主表ID:  <dx:ASPxGridView ID="grdProductivity"...>
子表ID:  <dx:ASPxGridView  ID="gv_detail"...>
 
加子表时,一定要加上以下代码:  <SettingsDetail ShowDetailRow="True"></SettingsDetail>
                    <Templates>
                        <DetailRow>
 
 
显示的列:<Columns>
                                    <dx:GridViewDataTextColumn VisibleIndex="0" FieldName="hh" Caption="序号" UnboundType="Integer" Name="hh" Width="5px">
                                    </dx:GridViewDataTextColumn>
            <dx:GridViewDataTextColumn VisibleIndex="1" FieldName="Production_Line_Desc" Caption="生产线名称">
                                    </dx:GridViewDataTextColumn> 
     </Columns>
//其中FieldName一定是sql查出来的字段,显示的列名为:Caption="生产线名称"
 
设置标题的样式;
        <Styles>
                        <Header ForeColor="#697a8a" Font-Bold="True" Font-Size="15px" BackColor="#EFF2F7" Border-BorderColor="#e3eae7"></Header>
                    </Styles>
 

DEVexpress控件使用 ASPxGridView 制作报表带子表的 备忘

标签:header   family   style   设置   code   temp   skin   set   序号   

原文地址:https://www.cnblogs.com/newsf/p/qq499513945.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!