当前位置: 代码迷 >> VB Dotnet >> GridView添加合计列,怎么对销售数量和销售金额列进行统计
  详细解决方案

GridView添加合计列,怎么对销售数量和销售金额列进行统计

热度:35   发布时间:2016-04-25 02:06:50.0
GridView添加合计列,如何对销售数量和销售金额列进行统计?
以下代码怎么改?
<asp:GridView ID="GridView1" runat="server" 
                    OnRowDataBound="OnRow_Bound"  
                    AutoGenerateColumns="False" 
                    cellspacing="1" 
                    DataKeyNames="proid" 
                    BorderStyle="None" 
                    BorderWidth="0px"
                    BackColor="Silver" 
                    EmptyDataText="没有查到符合条件的数据!"
                    width="100%" 
                    ShowFooter ="true">
                        <Columns>                        
                            <asp:TemplateField HeaderText="序号" HeaderImageUrl="~/images/refresh.gif">
                                <ItemTemplate>
                                <asp:Label ID="Label1" runat="server" Text="<%# GridView1.Rows.Count+ 1 %>"></asp:Label>
                                </ItemTemplate>
                                <ItemStyle HorizontalAlign="Center" />
                                <HeaderStyle Width="30px" />
                            </asp:TemplateField>
                            <asp:BoundField DataField="barcode" HeaderText="商品条码">
                            <HeaderStyle ForeColor="Black"  Width="80px"/>
                                    <ItemStyle HorizontalAlign ="Center" />
                                </asp:BoundField>
                            <asp:BoundField DataField="proid" HeaderText="商品代码">
                            <HeaderStyle ForeColor="Black"  Width="70px"/>
                                    <ItemStyle HorizontalAlign ="center" />
                                </asp:BoundField>
                            <asp:BoundField DataField="proname" HeaderText="商品名称">
                            <HeaderStyle ForeColor="Black"  Width="150px"/>
                                <ItemStyle HorizontalAlign ="center" />
                            </asp:BoundField>
                            <asp:BoundField DataField="measureid" HeaderText="单位">
                            <HeaderStyle ForeColor="Black"  Width="30px"/>
                                </asp:BoundField>
                            <asp:BoundField DataField="supname" HeaderText="供应商">
                            <HeaderStyle ForeColor="Black"  Width="150px"/>
                                <ItemStyle HorizontalAlign ="center" />
                            </asp:BoundField>
                            <asp:BoundField DataField="saleqty" HeaderText="销售数量"  HtmlEncode ="False" >
                                <HeaderStyle ForeColor="Black"  Width="80px"/>
                                <ItemStyle HorizontalAlign ="Center" />
                            </asp:BoundField>
                            <asp:BoundField DataField="saleamt" HeaderText="销售金额"  HtmlEncode ="False" >
                                <HeaderStyle ForeColor="Black"  Width="120px"/>
                                <ItemStyle HorizontalAlign ="Center" />
                            </asp:BoundField>
                        </Columns>
                        <RowStyle CssClass="list_gray" />
                        <FooterStyle BackColor="Silver" BorderStyle="None" HorizontalAlign="Right" />
                        <HeaderStyle CssClass="title" />
                        <AlternatingRowStyle BackColor="#EBFBF0" />
                        <EmptyDataRowStyle BackColor="#E0E0E0" Font-Bold="True" ForeColor="Red" />
                    </asp:GridView>
------解决思路----------------------
http://bbs.csdn.net/topics/120059056