protected void gvList_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { e.Row.Attributes.Add("onmouseover", "currentcolor=this.style.backgroundColor;this.style.backgroundColor='#EAF1FD',this.style.fontWeight='';"); e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=currentcolor,this.style.fontWeight='';"); Sell_OrderFPBacks model = e.Row.DataItem as Sell_OrderFPBacks; SumOrders.GoodNum += model.GoodNum; SumOrders.Total += model.Total; SumOrders.GoodSellPriceTotal += model.GoodSellPriceTotal; } ImageButton btnEdit = e.Row.FindControl("btnEdit") as ImageButton; if (btnEdit != null) { string val = string.Format("javascript:window.showModalDialog('CG_Orders.aspx?index={0}',null,'dialogWidth:500px;dialogHeight:450px;help:no;status:no')", e.Row.DataItemIndex); btnEdit.Attributes.Add("onclick", val); } // 合计 if (e.Row.RowType == DataControlRowType.Footer) { setValue(e.Row.FindControl("lblGoodName") as Label, "合计"); //合计 setValue(e.Row.FindControl("lblNum") as Label, SumOrders.GoodNum.ToString()); //数量 setValue(e.Row.FindControl("lblTotal") as Label, SumOrders.Total.ToString()); //成本总额 setValue(e.Row.FindControl("lblTotal1") as Label, SumOrders.GoodSellPriceTotal.ToString()); //成本总额 } }
protected void LinkButton1_Click1(object sender, EventArgs e) { if (Session["Orders"] != null) { if (Session["DioSell_OrderFP"] != null) { Sell_OrderFPService mailSer = new Sell_OrderFPService(); var model = mailSer.GetModel(Convert.ToInt32(Session["DioSell_OrderFP"])); txtFPNo.Text = model.FPNo; txtPOName.Text = model.POName; txtPONo.Text = model.PONo; txtSupplier.Text = model.GuestName; lblPID.Text = model.Id.ToString(); Sell_OrderFPsService sonSer = new Sell_OrderFPsService(); var sonList = sonSer.GetListArray(" ID=" + Session["DioSell_OrderFP"]); List <Sell_OrderFPBacks> POOrders = new List <Sell_OrderFPBacks>(); foreach (var m in sonList) { Sell_OrderFPBacks fpModel = new Sell_OrderFPBacks(); fpModel.Good_Model = m.Good_Model; fpModel.GoodName = m.GoodName; fpModel.GoodNo = m.GoodNo; fpModel.GoodNum = m.GoodNum; fpModel.GoodPrice = m.GoodPrice; fpModel.GoodRemark = model.Remark; fpModel.GoodSellPrice = m.GoodSellPrice; fpModel.GoodSellPriceTotal = m.GoodSellPriceTotal; fpModel.GoodSpec = m.GoodSpec; fpModel.GoodTypeSmName = m.GoodTypeSmName; fpModel.GoodUnit = m.GoodUnit; fpModel.GooId = m.GooId; fpModel.FPId = m.Ids; fpModel.SellOutPONO = ""; fpModel.Total = m.Total; POOrders.Add(fpModel); } Session["Orders"] = POOrders; Session["Sell_OrderOutHousesViewSession"] = null; gvList.DataSource = POOrders; gvList.DataBind(); } } }