0
I’m not being able to capture the various items selected in Lect2, how to do it? My goal will be to capture these items and send them to a Textbox, which I am using ?
A list, see below:
<asp:ListBox id="lb"
runat="server"
class="form-control input-sm select2-multiple"
Width="70%"
multiple>
<asp:ListItem Value="1">Administração</asp:ListItem>
<asp:ListItem Value="2">Administração Pública</asp:ListItem>
<asp:ListItem Value="3">Agronegócios e Agropecuária</asp:ListItem>
</asp:ListBox>
Like I’m trying to do ?
protected void Btn_Teste_Click(object sender, EventArgs e)
{
string message = "";
foreach (ListItem item in lb.Items)
{
if (item.Selected)
{
message += item.Text ;
}
}
TextBox.Text = message;
}
The way I’m doing is only returning the first selected item?
The way I’m doing is only returning the first selected item
– Fábio Medeiros Bitencourt
Take a look at the tour of the site
– novic