asp.net增加合计行
2012-06-04 08:19
99 查看
protected void gvWorkOrder_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow) //检查是否为datarow
{
totalcash += Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, "cash"));
{
if (e.Row.RowType == DataControlRowType.DataRow) //检查是否为datarow
{
totalcash += Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, "cash"));
totalunbalanced += Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, "unbalanced")); totalsettled += Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, "settled")); } else if(e.Row .RowType ==DataControlRowType .Footer ) { e.Row.Cells[0].Text = "合计"; e.Row.Cells[1].Text = totalcash.ToString("0.00"); e.Row.Cells[2].Text = totalunbalanced.ToString("0.00"); e.Row.Cells[3].Text = totalsettled.ToString("0.00"); e.Row.Font.Bold = true; }
if (e.Row.RowType == DataControlRowType.DataRow) //检查是否为datarow { //DateTime PlanStart = Convert.ToDateTime(DataBinder.Eval(e.Row.DataItem, "FName")); //取得数据 //if (PlanStart < DateTime.Parse(txtStartDate.Text)) //{ // e.Row.BackColor = System.Drawing.Color.FromName("#FFCCCC"); //颜色突出显示 //} double totalnum=0; double totalMoney=0; DataRowView drvBasicCountInfor = (DataRowView)e.Row.DataItem; double inum = Convert.ToDouble(drvBasicCountInfor[6].ToString());//6是第5列的数字 //生成总计 //totalNumber += iNumber; totalnum += inum; Double imoney = Convert.ToDouble(drvBasicCountInfor[8].ToString());//6是第5列的数字 //生成总计 //totalmoneyNumber += imoneyNumber; totalMoney += imoney; //e.Row.Cells[0].Text = "总计:"; //e.Row.Cells[5].Text = string.Format("{0}", totalnum); e.Row.Cells[6].Text = string.Format("{0:c}", totalMoney); e.Row.Cells[8].Text = string.Format("{0:c}", imoney); }
相关文章推荐
- asp.net GridView 在报表底部增加合计行
- asp.net表格控件Table(实例动态增加表格)
- FckEditor添加右键菜单;增加编辑区右键图片删除功能(asp.net )
- 在ASP.NET中应用Excel:(8)为HTML表格增加编辑功能
- ASP.NET 2.0中的数据操作之19:给新增、编辑界面增加验证控件
- Asp.net给站点某目录增加Aspnet用户
- 增加asp.net应用程序性能的20种方法(简单有效)
- ASP.NET中数据库的操作初步----增加、删除、修改
- ASP.NET中数据库的操作初步----增加、删除、修改
- ASP.NET 操作session详解 增加,修改,删除
- 重建程序员能力(3)-asp.net MVC框架增加Controller
- asp.net中获取新增加记录的ID Access版
- ASP.NET WebForm中要增加MVC特性?
- ASP.NET 操作Cookie详解 增加,修改,删除
- ASP.NET 2.0中新增加了2个很实用的属性和方法
- 【Jqurey EasyUI+Asp.net】---DataGrid增加、删、更改、搜
- asp.net中,如何给按钮增加JS事件
- Scott Mitchell 的ASP.NET 2.0数据教程之十九:给新增、编辑界面增加验证控件
- Asp.net 2.0 自定义控件开发专题讲解[为用户控件增加DataSource属性, 能够自动识别不同数据源](示例代码下载)
- ASP.NET MVC 3 扩展之增加一个验证 Email 格式的 DataAnnotation