listbox select event

listbox select event
To enable the listbox select event, you need to set listbox AutoPostBack proerty to true.

<asp:ListBox ID="ListBox1" runat="server" SelectionMode="Multiple" AutoPostBack="True" OnSelectedIndexChanged="ListBox1_SelectedIndexChanged">

<asp:ListItem>Moto</asp:ListItem>

<asp:ListItem>Samsung</asp:ListItem>

<asp:ListItem>Micro</asp:ListItem>

<asp:ListItem>Sony</asp:ListItem>

<asp:ListItem>AIWA</asp:ListItem>

<asp:ListItem>APPLE</asp:ListItem>

<asp:ListItem>Acer</asp:ListItem>

</asp:ListBox>

<br />


C# code behind

protected void ListBox1_SelectedIndexChanged(object sender, EventArgs e)

{

Response.Write(ListBox1.SelectedValue);

}

Tags:

listbox select eventAspnet Listbox Selectedindexchanged problems and solutionListbox select multipleHow to get Jquery selected optionJquery Dropdown Selected ValueListBox Asp.net Binding csharpGet Selected Value From Dropdownlist [JQuery]Gridview select emailJQuery Select ChangeHow to select multiple columns in Linq- C#.net VB.net codeasp.net add listBox items

Author

My name is Satalaj, but people call me Sat. Here is my homepage: . I live in Pune, PN and work as a Software Engineer. I'm former MVP in ASP.net year 2010.
Disclaimer: Views or opinion expressed here are my personal research and it has nothing to do with my employer. You are free to use the code, ideas/hints in your projects. However, you should not copy and paste my original content to other web sites. Feel free to copy or extend the code.
If you want to fight with me, this website is not for you.
 

I'm Satalaj.