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> <%# (( ...
随机推荐
- c# post方式发送请求
public static bool CheckNew(string serverIP) { bool passed = false; try { string url = string.Format ...
- BZOJ 2521 最小生成树(最小割)
http://www.lydsy.com/JudgeOnline/problem.php?id=2521 题意:每次能增加一条边的权值1,求最小代价让一条边保证在最小生成树里 思路:如果两个点中有环, ...
- Keil C51必须注意的一些有趣特性
Keil c51号称作为51系列单片机最好的开发环境,大家一定都很熟悉.它的一些普通的特性大家也都了解,(书上也都说有)如:因为51内的RAM很小,C51的函数并不通过堆栈传递参数(重入函数除外),局 ...
- Android使用自带JSONObject解析JSON数据
import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import android ...
- bzoj3431 [Usaco2014 Jan]Bessie Slows Down
Description [Brian Dean, 2014] Bessie the cow is competing in a cross-country skiing event at the wi ...
- Android_Studio 及SDK下载
Android Studio includes all the tools you need to build apps for Android. DOWNLOAD ANDROID STUDIO 2. ...
- tcp 状态示码 及 三次握手
TCP的几个状态对于我们分析所起的作用. 在TCP层,有个FLAGS字段,这个字段有以下几个标识:SYN, FIN, ACK, PSH, RST, URG. 其中,对于我们日常的分析有用的就是前面的五 ...
- xsank的快餐 » Python simhash算法解决字符串相似问题
xsank的快餐 » Python simhash算法解决字符串相似问题 Python simhash算法解决字符串相似问题
- 决策树之ID3算法实现(python)
决策树的概念其实不难理解,下面一张图是某女生相亲时用到的决策树: 基本上可以理解为:一堆数据,附带若干属性,每一条记录最后都有一个分类(见或者不见),然后根据每种属性可以进行划分(比如年龄是>3 ...
- jQuery 动画之 添加商品到购物车
前台页面 <link href="MyCar.css" rel="stylesheet" /> <script src="../jq ...