Good morning, I'm using dropdownlist
in asp.net
to load some data coming from the bank, however I do not know the amount that will be shown, because it depends on the fill in the bank.
I'd like to show only a certain amount of items.
For example, if you have 29 records, I want to show only the first 5 and after that, show the scroll bar, always with 5 records.
But every way I try I can not, is there any way I can limit the amount of dropdownlist
items that is populated by the database?
Dropdownlist:
<asp:DropDownList ID="cbfuncionario" runat="server" style = "overflow-y: scroll"></asp:DropDownList>
and here I load the dropdownlist:
public void CarregaFuncionario()
{
SqlCommand comando = new SqlCommand();
comando.Connection = clsdb.AbreBanco();
comando.CommandType = CommandType.Text;
comando.CommandText = "select pessoa.id,nome FROM [pessoa] inner join classificacoes on classificacoes.id = pessoa.classificacao_id where estado <> 'Inativo' and estado <> 'Excluido' and classificacoes.tipo = '1' order by pessoa.nome ASC";
SqlDataAdapter da = new SqlDataAdapter();
da.SelectCommand = comando;
DataSet ds = new DataSet();
da.Fill(ds);
cbfuncionario.DataSource = ds.Tables[0];
cbfuncionario.DataTextField = "nome";
cbfuncionario.DataValueField = "id";
cbfuncionario.DataBind();
}