protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e) { string opening_bank = ddl_opening_bank.SelectedValue; DropDownList ddl = sender as DropDownList; if (string.IsNullOrEmpty(opening_bank)) { return; } AccountAdapter aa = new AccountAdapter(); DataSet ds = aa.getAccountInfoByBankAndCurrency(opening_bank, Int32.Parse(ddl.SelectedValue)); if (ds.Tables[0].Rows.Count > 0) { TextBox2.Text = ds.Tables[0].Rows[0]["account_id"].ToString(); TextBox3.Text = ds.Tables[0].Rows[0]["account_name"].ToString(); TextBox4.Text = ds.Tables[0].Rows[0]["amount"].ToString(); } if (ddl.SelectedValue == "1000") { ddl_currency.SelectedValue = "1"; } else if (ddl.SelectedValue == "1") { ddl_currency.SelectedValue = "1000"; } ds = aa.getAccountInfoByBankAndCurrency(ddl_opening_bank.SelectedValue, Int32.Parse(ddl_currency.SelectedValue)); if (ds.Tables[0].Rows.Count > 0) { txt_account_id.Text = ds.Tables[0].Rows[0]["account_id"].ToString(); txt_account_name.Text = ds.Tables[0].Rows[0]["account_name"].ToString(); txt_amount.Text = ds.Tables[0].Rows[0]["amount"].ToString(); } }
protected void DropDownList2_SelectedIndexChanged(object sender, EventArgs e) { ddl_opening_bank.SelectedValue = DropDownList2.SelectedValue; ddl_currency.SelectedValue = "1000"; DropDownList1.SelectedValue = "1"; AccountAdapter aa = new AccountAdapter(); DataSet ds = aa.getAccountInfoByBankAndCurrency(ddl_opening_bank.SelectedValue, 1000); if (ds.Tables[0].Rows.Count > 0) { txt_account_id.Text = ds.Tables[0].Rows[0]["account_id"].ToString(); txt_account_name.Text = ds.Tables[0].Rows[0]["account_name"].ToString(); txt_amount.Text = ds.Tables[0].Rows[0]["amount"].ToString(); } ds = aa.getAccountInfoByBankAndCurrency(ddl_opening_bank.SelectedValue, 1); if (ds.Tables[0].Rows.Count > 0) { TextBox2.Text = ds.Tables[0].Rows[0]["account_id"].ToString(); TextBox3.Text = ds.Tables[0].Rows[0]["account_name"].ToString(); TextBox4.Text = ds.Tables[0].Rows[0]["amount"].ToString(); } }