protected void gdGeneral_RowEditing(object sender, GridViewEditEventArgs e)
    {
        divEdit.Visible = true;
        try
        {
            lblSCDetailAutoId.Text = ((Label)gdGeneral.Rows[e.NewEditIndex].FindControl("lblSCDetailAutoId")).Text;

            ddlCourierEdit.SelectedValue = ((Label)gdGeneral.Rows[e.NewEditIndex].FindControl("lblAutoId")).Text;
            ddlBranchEdit.SelectedValue  = ((Label)gdGeneral.Rows[e.NewEditIndex].FindControl("lblEmpID")).Text;
            txt_remark.Text = ((Label)gdGeneral.Rows[e.NewEditIndex].FindControl("lblRemark1")).Text;
            txtdept.Text    = ((Label)gdGeneral.Rows[e.NewEditIndex].FindControl("lblDepartment")).Text;
            if (ddlBranchEdit.SelectedValue != "0")
            {
                DataSet Ds = new DataSet();
                Ds = CourierDetails.GetCourierBranch(Convert.ToInt16(ddlBranchEdit.SelectedValue.ToString()), "BranchAddress");


                txtAddressEdit.Text = Ds.Tables[0].Rows[0]["Address"].ToString();
                Ds.Dispose();
                trBranchAddress.Visible      = true;
                trAddressGeneralEdit.Visible = false;
            }
            else
            {
                trAddressGeneralEdit.Visible = true;
                trBranchAddress.Visible      = false;
            }
        }
        catch
        {
        }
    }
Exemplo n.º 2
0
    protected void ddlBranch_SelectedIndexChanged(object sender, EventArgs e)
    {
        if (ddlBranch.SelectedValue.ToString() != "0")
        {
            trBranchAddress.Visible = true;
            DataSet Ds = new DataSet();
            Ds = CourierDetails.GetCourierBranch(Convert.ToInt16(ddlBranch.SelectedValue.ToString()), "BranchAddress");

            if (Ds.Tables[0].Rows[0]["Address"].ToString() != "")
            {
                txtAddress.Text          = Ds.Tables[0].Rows[0]["Address"].ToString();
                trAddressGeneral.Visible = false;
                txtAddressGeneral.Text   = "";
            }
            else
            {
                trAddressGeneral.Visible = false;
                txtAddressGeneral.Text   = "";
                MessageBox("Address not specified for " + ddlBranch.SelectedItem.Text.ToString() + " branch");
            }
        }
        else
        {
            trBranchAddress.Visible  = false;
            txtAddress.Text          = "";
            trAddressGeneral.Visible = true;
        }
    }
    protected void ddlBranchEdit_SelectedIndexChanged(object sender, EventArgs e)
    {
        if (ddlBranchEdit.SelectedValue.ToString() != "0")
        {
            trBranchAddress.Visible = true;
            DataSet Ds = new DataSet();
            Ds = CourierDetails.GetCourierBranch(Convert.ToInt16(ddlBranchEdit.SelectedValue.ToString()), "BranchAddress");


            txtAddressEdit.Text = Ds.Tables[0].Rows[0]["Address"].ToString();
            Ds.Dispose();
            trAddressGeneralEdit.Visible = false;
            txtAddressGeneralEdit.Text   = "";
        }
        else
        {
            trBranchAddress.Visible      = false;
            txtAddressEdit.Text          = "";
            trAddressGeneralEdit.Visible = true;
        }
    }