我有一个下拉列表,其中包含所有银行名称。我想在数据网格视图中显示信用额度。但下拉列表返回“System.Data.DataRowView”作为选定项的值。
这是代码:
private void cbxBank_SelectedIndexChanged(object sender, EventArgs e)
{
int i = cbxBank.SelectedIndex;
string bank = cbxBank.Text;
if (i != -1)
{
// this Function Returns the Table of CreditLimit According to Bank Name
DataTable CreditLimit = AM.ReturnAvailableCreditLimit(bank);
//this function just displays the table in Datat Grid View
DataGridViewDisplayDetails(CreditLimit);
}
}
在 DropdownList 中添加数据的代码
Bank = DbRdRw.SqlDbRead("Select BankName from BankMaster", "BankMaster");
cbxBank.DataSource = Bank;
cbxBank.ValueMember = "BankName";
cbxBank.DisplayMember = "BankName";
//ends