protected void btnShow_Click(object sender, EventArgs e)
    {
        if (Page.IsValid)
        {
            receivedOrderController = new ReceivedOrderController();
            int      poID      = Convert.ToInt32(ddlOrderNo.SelectedValue.ToString());
            string   supName   = receivedOrderController.getSupplierbyPOID(poID);
            DateTime date      = receivedOrderController.getOrderDate(poID);
            string   orderDate = date.ToString("dd/MM/yyyy");

            lblOrdDateDec.Visible    = true;
            lblOrdDate.Visible       = true;
            lblSupplierDes.Visible   = true;
            lblSupplierName.Visible  = true;
            lblDONo.Visible          = true;
            txtDeliveryOrdNo.Visible = true;
            btnSave.Visible          = true;


            lblSupplierName.Text        = supName;
            lblOrdDate.Text             = orderDate;
            GdvReceivedOrder.DataSource = receivedOrderController.getListDataTable(poID);
            GdvReceivedOrder.DataBind();
            ViewState["CurrentData"] = receivedOrderController.getListDataTable(poID);
            GdvReceivedOrder.DataBind();
            btnSave.Visible = true;
        }
    }
    protected void GdvReceivedOrder_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        udt = (DataTable)ViewState["CurrentData"];
        GridViewRow editedRow = GdvReceivedOrder.Rows[e.RowIndex];

        string  itemID      = GdvReceivedOrder.DataKeys[e.RowIndex].Value.ToString();
        int     receivedQty = Convert.ToInt32(((TextBox)(editedRow.Cells[4].Controls[0])).Text);
        TextBox txtremark   = (TextBox)editedRow.Cells[0].FindControl("txtRemark");
        string  remark      = txtremark.Text;

        foreach (DataRow dr in udt.Rows)
        {
            if (dr["ItemID"].ToString() == itemID)
            {
                dr["ReceivedQty"] = receivedQty;
            }
        }
        GdvReceivedOrder.EditIndex  = -1;
        GdvReceivedOrder.DataSource = udt;
        GdvReceivedOrder.DataBind();
        ViewState["CurrentData"] = udt;

        Session["MyData"] = udt;
    }
 public void loadData()
 {
     GdvReceivedOrder.DataSource = ViewState["CurrentData"];
     GdvReceivedOrder.DataBind();
 }
 void ClearGridView()
 {
     GdvReceivedOrder.DataSource = null;
     GdvReceivedOrder.DataBind();
 }