How to search a dropdownlist?

-3

I have a Dropdown that lists the names of all banks. I need to create a method in which it brings me a set of results and among them the name of the bank. This bank that my list brings (just a record) should cause my Dropdownlist to show this name, as if it were a search inside the drop, I do not know if I was clear.

Okay, I'll explain. I have a combo or dropdown that lists all the banking institutions. I have a search that returns the name of the bank, by the CPF or CNPJ of the respondent. What I want is that when I return, for example, Banco Bradesco the combo should show Banco Bradesco. I can not do this in a combo. I've already tried to force it and I can not bring anything.

John has an account with Itaú and he is registered in my system. When I enter João's CPF or CNPJ, you will bring me the Name of the Bank, Agency and Account. But there is a combo with the name of the institutions in a panel that will be displayed. I would like the return to show in the combo the name of the bank. The txt I have filled in with Account and Agency and Bank number, but I am having difficulty showing the bank name because it is in a combo. If the bank name does not exist in the Combo, then I give a message and do what I have to do. It is WEBFORM

My difficulty is exactly at the moment of showing the text. I did so and I can not show the text. Where nm_banco is the bank number or the value of the combo.

for (int i = 0; i < cmbBancos.Items.Count - 1; i++)
                    {
                        if (cmbBancos.Items[i].Value == nm_banco)
                            cmbBancos.Text = cmbBancos.Items[i].Text;
                    }
    
asked by anonymous 29.12.2014 / 16:22

1 answer

0
cmbBancos.SelectedValue = nm_banco;
cmbBancos_SelectedIndexChanged(this, EventArgs.Empty);
    
30.12.2014 / 13:37