protected void GetPurchaseRequisitionProductListById(string purchaseRequisitionId)
        {
            PurchaseRequisitionBLL purchaseRequisition = new PurchaseRequisitionBLL();

            try
            {
                DataTable dt = purchaseRequisition.GetPurchaseRequisitionProductListById(purchaseRequisitionId);

                if (dt.Rows.Count > 0)
                {
                    purchaseRequisitionProductListGridView.DataSource = dt;
                    purchaseRequisitionProductListGridView.DataBind();

                    if (purchaseRequisitionProductListGridView.Rows.Count > 0)
                    {
                        approveButton.Enabled = true;
                        purchaseRequisitionProductListGridView.UseAccessibleHeader = true;
                        purchaseRequisitionProductListGridView.HeaderRow.TableSection = TableRowSection.TableHeader;

                        TextBox approveQuantityTextBox;
                        TextBox unitPriceTextBox;
                        DropDownList vendorDropDownList;

                        VendorBLL vendor = new VendorBLL();
                        DataTable dtVendor=new DataTable();

                        for (int i = 0; i < purchaseRequisitionProductListGridView.Rows.Count; i++)
                        {
                            
                            approveQuantityTextBox = (TextBox)purchaseRequisitionProductListGridView.Rows[i].FindControl("approveQuantityTextBox");
                            //approveQuantityTextBox.Text = purchaseRequisitionProductListGridView.Rows[i].Cells[3].Text.ToString();
                            approveQuantityTextBox.Text = dt.Rows[i][3].ToString();
                            unitPriceTextBox = (TextBox)purchaseRequisitionProductListGridView.Rows[i].FindControl("unitPriceTextBox");
                            unitPriceTextBox.Text = dt.Rows[i]["UnitPrice"].ToString();
                            dtVendor = vendor.GetProductVendorsByProductId(purchaseRequisitionProductListGridView.Rows[i].Cells[0].Text.ToString());
                            vendorDropDownList = (DropDownList)purchaseRequisitionProductListGridView.Rows[i].FindControl("vendorDropDownList");
                            vendorDropDownList.DataSource = dtVendor;
                            vendorDropDownList.DataValueField = "VendorId";
                            vendorDropDownList.DataTextField = "VendorName";
                            vendorDropDownList.DataBind();
                            vendorDropDownList.Items.Insert(0, "");
                            vendorDropDownList.SelectedIndex = 0;
                            vendorDropDownList.Items.Insert(dtVendor.Rows.Count+1, "Select Others.");
                        }
                    }
                    else
                    {
                        approveButton.Enabled = false;
                    }
                }
                else
                {
                    msgbox.Visible = true; msgTitleLabel.Text = "Data Not Found!!!"; msgDetailLabel.Text = "";
                }
            }
            catch (Exception ex)
            {
                msgbox.Visible = true; msgTitleLabel.Text = "Exception!!!"; msgDetailLabel.Text = ex.Message;
            }
            finally
            {
                purchaseRequisition = null;
            }
        }
        protected void productVendorButton_Click(object sender, EventArgs e)
        {
            ProductBLL product = new ProductBLL();
            VendorBLL vendor = new VendorBLL();

            try
            {
                DataTable dt = product.GetProductByBarcodeIdName(productTextBox.Text.Trim());

                if (dt.Rows.Count > 0)
                {
                    barcodeLabel.Text = dt.Rows[0]["Barcode"].ToString();
                    productIdLabel.Text = dt.Rows[0]["ProductId"].ToString();
                    productNameLabel.Text = dt.Rows[0]["ProductName"].ToString();
                    productGroupNameLabel.Text = dt.Rows[0]["ProductGroupName"].ToString();

                    productVendorListListBox.Items.Clear();
                    DataTable dtVendor = vendor.GetProductVendorsByProductId(productIdLabel.Text.Trim());

                    for (int i = 0; i < dtVendor.Rows.Count; i++)
                    {
                        productVendorListListBox.Items.Add(new ListItem(dtVendor.Rows[i]["VendorName"].ToString(), dtVendor.Rows[i]["VendorId"].ToString()));
                    }

                    productVendorPane.Visible = true;
                }
                else
                {
                    productVendorPane.Visible = false;
                    msgbox.Visible = true; msgTitleLabel.Text = "Product Data Not Found!!!"; msgDetailLabel.Text = "";
                    msgbox.Attributes.Add("class", "alert alert-warning");
                }
            }
            catch (Exception ex)
            {
                string message = ex.Message;
                if (ex.InnerException != null) { message += " --> " + ex.InnerException.Message; }
                MyAlertBox("ErrorAlert(\"" + ex.GetType() + "\", \"" + message + "\", \"\");");
            }
            finally
            {
                product = null;
                vendor = null;
                countProductVendorLabel.Text = "Total: " + productVendorListListBox.Items.Count.ToString();
                MyAlertBox("MyOverlayStop();");
            }
        }