protected void GridView_SelectedIndexChanged(object sender, EventArgs e) { string hello = ""; hello = GridView1.SelectedDataKey["id"].ToString(); busReceiveOrders ReceiveOrder = new busReceiveOrders(); FrameWork.ReceiveOrderDetails[] frmDRSI; frmDRSI = ReceiveOrder.allPurchaseOrderDetails(hello); GridView2.DataSource = frmDRSI; GridView2.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { if (Session["user"] == null) { Response.Redirect("Login.aspx"); } if (!IsPostBack) { busReceiveOrders busReceive = new busReceiveOrders(); FrameWork.ReceiveOrders[] frmDRSI; frmDRSI = busReceive.allPO(); GridView1.DataSource = frmDRSI; GridView1.DataBind(); } }
protected void btnSave_Click(object sender, EventArgs e) { dtgridList = (DataTable)ViewState["dtgridList"]; string users = Session["id"].ToString(); decimal totalamt = 0; try { FrameWork.ReceiveOrders RRO = new FrameWork.ReceiveOrders(); FrameWork.ReceiveOrderDetails PROsub = new ReceiveOrderDetails(); busReceiveOrders busPRO = new busReceiveOrders(); RRO.SupplierID = int.Parse(this.drpSupplier.SelectedValue); RRO.CreatedById = int.Parse(users); string x = busPRO.insertRR(RRO); foreach (DataRow dr in dtgridList.Rows) { PROsub.ReceiveOrderID = int.Parse(x); PROsub.Quantity = Single.Parse(dr["Quantity"].ToString()); PROsub.ProductID = int.Parse(dr["ProductID"].ToString()); busPRO.insertReceiveOrderDetails(PROsub); } } catch (Exception ex) { } finally { this.txtQuantity.Text = string.Empty; this.txtUOM.Text = string.Empty; this.drpProduct.SelectedValue = "0"; this.lblDescription.Text = string.Empty; //this.txtUnitPrice.Text = string.Empty; this.drpSupplier.SelectedValue = "0"; // this.txtTerms.Text = string.Empty; DataTable ds = new DataTable(); ds = null; this.grdList.DataSource = ds; grdList.DataBind(); } }