c# GridView Footor列求合计
显示效果:
前台代码:
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<link href="../../Css/default.css" rel="stylesheet" type="text/css" />
<script src="../../../Common/Scripts/Order/popup.js" type="text/javascript"></script>
<script src="../../../Common/My97DatePicker/WdatePicker.js" type="text/javascript"></script>
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div class="default_title_all" style="width: 98%">
<ul>
<li class='hovertab '><span style="color: White">供应商综合分析</span></li>
</ul>
</div>
<asp:ScriptManager ID="ScriptManager1" runat="server">
<Scripts>
</Scripts>
</asp:ScriptManager>
<uc4:SupplyAnalysis ID="SupplyAnalysis1" runat="server" />
<div class="default_title_all" style="width: 98%">
<ul>
</ul>
</div>
<table width="98%" border="" align="center" cellpadding="" cellspacing="">
<tr>
<td align="center" valign="top">
<table width="100%" border="" cellspacing="" cellpadding="">
<tr>
<td>
<table width="100%" border="" cellspacing="" cellpadding="" class="margin_center default_table_nobottom_dingdan">
<tr valign="middle">
<td align="right">
区域:
</td>
<td align="left">
<uc3:DropDownListUC ID="ddlArea" runat="server" CssClass="w120" />
</td>
<td align="right">
客户经理:
</td>
<td align="left">
<uc3:DropDownListUC ID="ddlClientManager" runat="server" CssClass="w120" />
</td>
<td align="right">
政策类型:
</td>
<td align="left">
<asp:DropDownList runat="server" ID="ddlType">
<asp:ListItem Text="全部" Value=""></asp:ListItem>
<asp:ListItem Text="普通" Value=""></asp:ListItem>
<asp:ListItem Text="特价" Value=""></asp:ListItem>
<asp:ListItem Text="直减" Value=""></asp:ListItem>
</asp:DropDownList>
</td>
<td align="right">
日期:
</td>
<td align="left">
<input type="text" id="txtBeginTime" runat="server" onfocus="WdatePicker({startDate:'%y-%M-01 00:00:00',dateFmt:'yyyy-MM-dd HH:mm:ss',alwaysUseStartDate:true})"
readonly="readonly" />
至<input type="text" id="txtEndTime" runat="server" onfocus="WdatePicker({startDate:'%y-%M-01 00:00:00',dateFmt:'yyyy-MM-dd HH:mm:ss',alwaysUseStartDate:true})" />
</td>
<td>
</td>
</tr>
<tr valign="middle">
<td align="right">
航司:
</td>
<td align="left">
<uc3:DropDownListUC ID="ddlAirwayCompanyCode" runat="server" CssClass="w120" />
</td>
<td align="right">
出发:
</td>
<td align="left">
<uc3:TextBoxUC ID="txtDeparturePort" runat="server" CssClass="w120" />
</td>
<td align="right">
到达:
</td>
<td align="left">
<uc3:TextBoxUC ID="txtArrivePort" runat="server" CssClass="w120" />
</td>
<td>
</td>
<td align="left">
<asp:Button ID="btnSearch" runat="server" Text="查 询" CssClass="button_1" OnClick="btnSelect_Click" />
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<table width="100%" border="" cellspacing="" cellpadding="">
<tr>
<td rowspan="">
<asp:GridView ID="gvInterfaceUser" runat="server" Width="100%" AutoGenerateColumns="False"
GridLines="None" CellPadding="" ShowHeaderWhenEmpty="true" OnRowDataBound="gvInterfaceUser_RowDataBound"
CssClass="default_table margin_center dingdan_table margin_top_10" OnRowCommand="gvInterfaceUser_RowCommand" ShowFooter="True">
<RowStyle HorizontalAlign="Center" CssClass="MsOverBgColor"></RowStyle>
<HeaderStyle HorizontalAlign="Center" Height="28px" CssClass="background_efeff0">
</HeaderStyle>
<FooterStyle HorizontalAlign="Center" Height="28px" CssClass="background_efeff0"
ForeColor="Red" />
<Columns>
<asp:TemplateField HeaderText="序号">
<ItemTemplate>
<%#Container.DataItemIndex+ %>
</ItemTemplate>
<ItemStyle Width="4%" CssClass="default_table_zc_left default_table_zc_bottom" />
</asp:TemplateField>
<asp:BoundField DataField="suUserName" HeaderText="供应商">
<ItemStyle Width="8%" CssClass="default_table_zc_left default_table_zc_bottom" />
</asp:BoundField> <asp:BoundField DataField="sumCount" HeaderText="总票量">
<ItemStyle Width="8%" CssClass=" default_table_zc_left default_table_zc_bottom" />
</asp:BoundField>
<asp:BoundField DataField="pastePoint" HeaderText="贴点票量">
<ItemStyle Width="8%" CssClass=" default_table_zc_left default_table_zc_bottom" />
</asp:BoundField>
<asp:BoundField DataField="feesReceivable" HeaderText="手续费应收" DataFormatString="{0:0.00}">
<ItemStyle Width="8%" CssClass="default_table_zc_left default_table_zc_bottom" />
</asp:BoundField>
<asp:BoundField DataField="pasteTotalMoney" HeaderText="贴点金额" DataFormatString="{0:0.00}">
<ItemStyle Width="8%" CssClass="default_table_zc_left default_table_zc_bottom" />
</asp:BoundField>
<asp:TemplateField HeaderText="实际收入">
<ItemTemplate>
<%# (Convert.ToDecimal(Eval("feesReceivable")) - Convert.ToDecimal(Eval("pasteTotalMoney"))).ToString("0.00")%>
</ItemTemplate>
<ItemStyle Width="10%" CssClass="default_table_zc_left default_table_zc_bottom" />
</asp:TemplateField>
<asp:BoundField DataField="DepartCityCount" HeaderText="本地出发票量">
<ItemStyle Width="8%" CssClass="default_table_zc_left default_table_zc_bottom" />
</asp:BoundField>
<asp:BoundField DataField="ArriveCityCount" HeaderText="回本地票量">
<ItemStyle Width="8%" CssClass="default_table_zc_left default_table_zc_bottom" />
</asp:BoundField>
<asp:TemplateField HeaderText="异地票量">
<ItemTemplate>
<%# Convert.ToInt32(Eval("sumCount")) - Convert.ToInt32(Eval("DepartCityCount"))-Convert.ToInt32(Eval("ArriveCityCount")) %>
</ItemTemplate>
<ItemStyle Width="10%" CssClass="default_table_zc_left default_table_zc_bottom" />
</asp:TemplateField>
<asp:BoundField DataField="specailCount" HeaderText="特价票量">
<ItemStyle Width="8%" CssClass="default_table_zc_left default_table_zc_bottom" />
</asp:BoundField>
</Columns>
<AlternatingRowStyle CssClass="F0F0F0 MsOverBgColor" Height="28px" />
</asp:GridView>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<div id="sumCount" runat="server" style="padding-left: 20px; padding-top: 10px;display:none;">
<label>
合计</label>总票量: 贴点票量:<asp:Label runat="server" ID="lblsumPasteTicketCount"></asp:Label> 手续费应收:<asp:Label
runat="server" ID="lblRecived"></asp:Label>
贴点金额:<asp:Label runat="server" ID="lblPasteMoney"></asp:Label> 实际收入:<asp:Label
runat="server" ID="lblActualIncome"></asp:Label>
</div>
</td>
</tr>
<tr>
<td align="center" colspan="">
<uc1:WUCWorkPager ID="WUCWorkPager1" runat="server" />
</td>
</tr>
</table>
</td>
</tr>
</table>
<div id="details" style="display: none;">
<table>
<tr>
<td>
请求
</td>
<td>
<div id="tdRequest" runat="server">
</div>
</td>
</tr>
<tr>
<td>
返回
</td>
<td>
<div id="tdResponse" runat="server">
</div>
</td>
</tr>
</table>
</div>
</form>
</body>
</html>
后台代码:
public decimal mysum3 = ;//总票量
public decimal mysum4 = ;//贴点票量
public decimal mysum5 = ;//手续费应收
public decimal mysum6 = ;//贴点金额
public decimal mysum7 = ;//本地出发票量
public decimal mysum8 = ;//回本地票量
public decimal mysum9 = ;//特价票量 protected void gvInterfaceUser_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
DataRowView myrows = (DataRowView)e.Row.DataItem; mysum3 += Convert.ToDecimal(myrows[].ToString() == "" ? "" : myrows[].ToString());
mysum4 += Convert.ToDecimal(myrows[].ToString() == "" ? "" : myrows[].ToString());
mysum5 += Convert.ToDecimal(myrows[].ToString() == "" ? "" : myrows[].ToString());
mysum6 += Convert.ToDecimal(myrows[].ToString() == "" ? "" : myrows[].ToString());
mysum7+= Convert.ToDecimal(myrows[].ToString() == "" ? "" : myrows[].ToString());
mysum8 += Convert.ToDecimal(myrows[].ToString() == "" ? "" : myrows[].ToString());
mysum9 += Convert.ToDecimal(myrows[].ToString() == "" ? "" : myrows[].ToString()); }
// 合计
if (e.Row.RowType == DataControlRowType.Footer)
{
e.Row.Cells[].Text = "合计";
e.Row.Cells[].Text = mysum3.ToString();
e.Row.Cells[].Text = mysum4.ToString();
e.Row.Cells[].Text = mysum5.ToString("0.00");
e.Row.Cells[].Text = mysum6.ToString("0.00");
// 实际收入
e.Row.Cells[].Text = (mysum5 - mysum6).ToString("0.00");
e.Row.Cells[].Text = mysum7.ToString();
e.Row.Cells[].Text = mysum8.ToString();
// 异地票量
e.Row.Cells[].Text = (mysum3-mysum7-mysum8).ToString();
e.Row.Cells[].Text = mysum9.ToString(); }
}
c# GridView Footor列求合计的更多相关文章
- android手机旋转屏幕时让GridView的列数与列宽度自适应
无意中打开了一年前做过的一个android应用的代码,看到里面实现的一个小功能点(如题),现写篇文章做个笔记.当时面临的问题是,在旋转屏幕的时候需要让gridview的列数与宽度能自适应屏幕宽度,每个 ...
- Asp.net 设置GridView自适应列宽不变形
动态绑定的GridView由于列数不固定,而列又太多,这样设置GridView固定宽度就不能满足需求了.为此整理了两种方法来达到GridView自适应列宽不变形的效果. //在GridView的行数据 ...
- GridView模版列中设置
在GridView模版列中设置如下<asp:TemplateField HeaderText="删除"> <ItemTemplate> ...
- 如何在asp.net中获取GridView隐藏列的值?
在阅读本文之前,我获取gridview某行某列的值一般做法是这样的:row.Cells[3].Text.ToString().有点傻瓜呵呵 在Asp.net 2.0中增加了一个新的数据绑定控件:Gri ...
- 鼠标指向GridView某列显示DIV浮动列表
需求: 当GRIDVIEW数据列过多,不方便全部显示在同一行或者一些子信息需要鼠标指向某关键列GRIDVIEW的时候显示其子信息. 设计:先把需要显示的浮动数据一次过抓取出来.而不是鼠标指向的时候才从 ...
- 解决无法获取 GridView 隐藏列值问题
今天遇到了一个要获取GridView隐藏列值的问题,试了好几种方法,要么获取不到,要么获取到了类列的值也隐藏了,但在样式中这一列会多出一块,,但最后找到了一个功能实现而且实现了列完美隐藏的方法和大家分 ...
- Asp.net简单代码设置GridView自适应列宽不变形
动态绑定的GridView由于列数不固定,而列又太多,是要自定设置gridView的宽度 //在GridView的行数据绑定完的事件中设置 protected void gvObjectList_Ro ...
- Numpy 学习 array np.where lexsort 切片 按行按列求平均mean
array 的创建可以通过list给 array print出来像一个表格,可以按行按列来观察. 原来是一个list相当于一行 np.where用于寻找一个condition下的坐标,返回的是一个2个 ...
- .Net GridView 序号列
给GridView增加一列:序号列 <asp:TemplateField HeaderText="序号"> <ItemTemplate> <%# (( ...
随机推荐
- Log4net从下载到使用例子
一.首先下载log4net.dll http://pan.baidu.com/s/1gdigrwJ 二.添加log4net引用 三.代码: using System; using System.C ...
- AsEnumrable和AsQueryable的区别
http://www.cnblogs.com/jianglan/archive/2011/08/11/2135023.html 在写LINQ语句的时候,往往会看到.AsEnumerable() 和 . ...
- Core Data的使用(二)备
一.基础概念深入 1.NSManagedObjectContext 被管理数据上下文就像便笺簿 当从数据持久层获取数据时,相当于把这些临时的数据拷贝写在便笺簿上,然后就可以随心所欲的修改这些值. 通过 ...
- 【ROC曲线】关于ROC曲线、PR曲线对于不平衡样本的不敏感性分析说引发的思考
ROC曲线 在网上有很多地方都有说ROC曲线对于正负样本比例不敏感,即正负样本比例的变化不会改变ROC曲线.但是对于PR曲线就不一样了.PR曲线会随着正负样本比例的变化而变化.但是没有一个有十分具体和 ...
- PowerShell_零基础自学课程_5_自定义PowerShell环境及Powershell中的基本概念
PowerShell_零基础自学课程_5_自定义PowerShell环境及Powershell中的基本概念 据我个人所知,windows下的cmd shell除了能够通过修改系统参数来对其中的环境变量 ...
- 2015第15周六Java线程池
Java里面线程池的顶级接口是Executor,但是严格意义上讲Executor并不是一个线程池,而只是一个执行线程的工具.真正的线程池接口是ExecutorService. 比较重要的几个类: Ex ...
- Makefile中使用foreach生成一类规则
CSDN上,有朋友发帖问了这样一个问题(我按自己的理解翻译一下): 当前目录下有四个静态库文件: liba.a libb.a libc.a libd.a.现在想将它们做成一个动态库libp.so. ...
- MySQL查询随机数据的4种方法和性能对比
从MySQL随机选取数据也是我们最常用的一种发发,其最简单的办法就是使用”ORDER BY RAND()”,本文介绍了包括ORDER BY RAND()的4种获取随机数据的方法,并分析了各自的优缺点. ...
- OpenReports中文支持方案
此文章在<OpenReports中文支持完全解决方案.doc>的基础上做优化,并贴出代码.已测试通过. 一.主要解决的问题 1 页面显示支持中文 2 与服务器或数据库的交互支持中文 3 查 ...
- C#操作IE
操作IE主要使用两个Com Dll: 1.Microsoft Internet Controls 2.Microsoft HTML Object Library 使用Microsoft Interne ...