Click here to Skip to main content
15,940,921 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i want to clear select item in listbox. now time when i select item and send then item in listbox not clear .so how to these particular item delete. plz give me suggestion.
thanks,
MK.
Posted
Comments
Raajkumar.b 17-Jan-14 1:38am    
ListBox1.ClearSelection();
http://asp-net-example.blogspot.in/2011/07/how-to-use-listbox-clearselection.html

1 solution

Try like this..

C#
protected void BtnRemove_Click(object sender, EventArgs e)
{
    int[] itemsSelected = ListBox1.GetSelectedIndices();
    for (int i = 0; i < itemsSelected.Length; i++)
        ListBox1.Items.RemoveAt(i);

}
 
Share this answer
 
Comments
Praveen_P 17-Jan-14 4:02am    
5
Karthik_Mahalingam 17-Jan-14 4:09am    
thanks Praveen :)
Rahul VB 18-Jan-14 12:14pm    
very nice 5+
Karthik_Mahalingam 18-Jan-14 13:07pm    
THanks Rahul :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900