示例#1
0
    protected void ddlVessel_SelectedIndexChanged(object sender, EventArgs e)
    {
        DataTable dt = new DataTable();

        try{
            if (ddlVessel.SelectedValue != "0")
            {
                dt = oCP.GET_VesselOwner_Detail(UDFLib.ConvertIntegerToNull(ddlVessel.SelectedValue));
            }
            if (dt.Rows.Count > 0)
            {
                DataRow  dr              = dt.Rows[0];
                ListItem li              = new ListItem();
                string   Owner_Id        = dr["Owner_Id"].ToString();
                string   Bank_Account_Id = dr["Bank_Account_ID"].ToString();
                if (Owner_Id != "0")
                {
                    li = ddlOwner.Items.FindByValue(Owner_Id);
                    if (li != null)
                    {
                        ddlOwner.SelectedValue = Owner_Id;
                        li.Attributes.Add("style", "background-color:#FFFF00");
                    }
                    else
                    {
                        ddlOwner.SelectedValue = "0";
                    }
                }
                if (Bank_Account_Id != "0")
                {
                    li = ddlOwnerBank.Items.FindByValue(Bank_Account_Id);
                    if (li != null)
                    {
                        ddlOwnerBank.SelectedValue = Bank_Account_Id;
                        li.Attributes.Add("style", "background-color:#FFFF00");
                    }
                    else
                    {
                        ddlOwnerBank.SelectedValue = "0";
                    }
                }
            }
        }
        catch {}
    }