protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
 {
     string id = "";
     id = GridView1.SelectedDataKey["id"].ToString();
     busProductRequestOrder busProductReq = new busProductRequestOrder();
     FrameWork.ProductRequestOrderDetails[] frmDRSI;
     frmDRSI = busProductReq.retrieveProductRequestOrderDetails(id);
     GridView2.DataSource = frmDRSI;
     GridView2.DataBind();
 }
        protected void btnSave_Click(object sender, EventArgs e)
        {
            dtgridList = (DataTable)ViewState["dtgridList"];
            string users = Session["id"].ToString();
            decimal totalamt = 0;

            try
            {
                foreach (DataRow dr in dtgridList.Rows)
                {
                    totalamt = totalamt + decimal.Parse(dr["Amount"].ToString());
                }
                FrameWork.ProductRequestOrder PRO = new FrameWork.ProductRequestOrder();
                FrameWork.ProductRequestOrderDetails PROsub = new ProductRequestOrderDetails();
                busProductRequestOrder busPRO = new busProductRequestOrder();
                PRO.SupplierID = int.Parse(this.drpSupplier.SelectedValue);
                PRO.CreatedById = int.Parse(users);
                PRO.ExpectedDate = DateTime.Parse(this.txtDateNeeded.Text);
                PRO.PaymentAmount = totalamt;

                string x = busPRO.insertProductRequestOrder(PRO);
                foreach (DataRow dr in dtgridList.Rows)
                {
                    PROsub.ProductRequestOrderID = int.Parse(x);
                    PROsub.Quantity = Single.Parse(dr["Quantity"].ToString());
                    PROsub.UnitCost = decimal.Parse(dr["UnitPrice"].ToString());
                    PROsub.ProductID = int.Parse(dr["ProductID"].ToString());

                    busPRO.insertProductRequestOrderDetails(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 = (DataTable)ViewState["dtgridList"]; ;
                ds.Clear();
                this.grdList.DataSource = ds;
                grdList.DataBind();

            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["user"] == null)
            {
                Response.Redirect("Login.aspx");
            }
            if (!IsPostBack)
            {

                busProductRequestOrder busProductReq = new busProductRequestOrder();
                FrameWork.ProductRequestOrder[] frmDRSI;

                frmDRSI = busProductReq.retrieveProductRequestOrder();
                GridView1.DataSource = frmDRSI;
                GridView1.DataBind();

            }
        }