private void DataGrid1_ItemCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e) { if (e.CommandName == "Add") { try { if (Session["ProductList"] == null) { Popup("请选择产品"); return; } DataTable dtDetail = (DataTable)Session["ProductList"]; if (dtDetail.Rows.Count == 0) { Popup("请选择订单里面没有的产品"); return; } OrderFacade order = new OrderFacade(); string strOrderSerialNo = txtOrderSerialNo.Text; OperLog operLog = new OperLog(); operLog.cnvcOperID = oper.strLoginID; operLog.cnvcDeptID = oper.strDeptID; operLog.cnvcOperType = "订单加产品"; order.AddDetail(strOrderSerialNo, operLog, dtDetail); Session["ProductList"] = null; this.DataGrid1.DataSource = null; this.DataGrid1.DataBind(); BindDetail(strOrderSerialNo); Popup("订单中加入产品成功"); } catch (Exception ex) { Popup(ex.Message); } } }