protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["UserID"] == null)
        {
            Response.Redirect(CommonVariables.LoginURL);
        }
        if (!Page.IsPostBack)
        {
            FillDropDownList();

            if (Request.QueryString["CustomerID"] != null)
            {
                LoadControls(Convert.ToInt32(Request.QueryString["CustomerID"]));
                CommonFillMethod.FillDropDownListBranchToDistributor(ddlDistributorID, Convert.ToInt32(ddlBranchID.SelectedValue));
                lblPageHeader.Text = "Edit Customer Details";
            }
            else
            {
                lblPageHeader.Text = "Add New Customer";
            }
        }
    }
    public void ddlCustomer_SelectedIndexChanged(object sender, EventArgs e)
    {
        RegularOrderENT entRegularOrder = new RegularOrderENT();
        RegularOrderBAL balRegularOrder = new RegularOrderBAL();

        if (ddlCustomerID.SelectedIndex > 0)
        {
            DataTable dt = balRegularOrder.FillCustomer(Convert.ToInt32(ddlCustomerID.SelectedValue));

            if (dt != null && dt.Rows.Count > 0)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    if (!dr["BranchID"].Equals(DBNull.Value))
                    {
                        ddlBranchID.SelectedValue = Convert.ToInt32(dr["BranchID"]).ToString();
                    }

                    CommonFillMethod.FillDropDownListBranchToDistributor(ddlDistributorID, Convert.ToInt32(ddlBranchID.SelectedValue));

                    if (!dr["ProductID"].Equals(DBNull.Value))
                    {
                        ddlProductID.SelectedValue = Convert.ToInt32(dr["ProductID"]).ToString();
                    }

                    if (!dr["Quantity"].Equals(DBNull.Value))
                    {
                        txtQuantity.Text = Convert.ToInt32(dr["Quantity"]).ToString();
                    }

                    ProductAutoSelect();
                    BottleAmount_TextChanged();
                    Quantity_TextChanged();
                }
            }
        }
    }
 protected void ddlBranch_SelectedIndexChanged(object sender, EventArgs e)
 {
     CommonFillMethod.FillDropDownListBranchToDistributor(ddlDistributorID, Convert.ToInt32(ddlBranchID.SelectedValue));
 }