//绑定银行 private void BindBank() { DataTable dt = RemittancesBLL.GetBank(); BankName.DataSource = dt; BankName.DataTextField = "BankName"; BankName.DataValueField = "ID"; BankName.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { con.Open(); DisplayRecord(); SqlCommand cmd = new SqlCommand("select distinct BABankName from BankAdminBankDetails where BAStatus = 'Approved'", con); using (SqlDataReader dr = cmd.ExecuteReader()) { if (dr.HasRows) { BankName.DataSource = dr; BankName.DataTextField = "BABankName"; BankName.DataValueField = "BABankName"; BankName.DataBind(); BankName.Items.Insert(0, new ListItem("-Select-", "0")); } } } }