Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


how to remove or delete multiple selected items from listbox in on button click in asp?



how to remove or delete multiple selected items from listbox in on button click in asp?..

Answer / Mohit Rathi

To remove or delete multiple selected items from a ListBox in ASP.NET on button click, you can use the `SelectedIndexChanged` event of the Button control and iterate through the selected items of the ListBox to remove them.nnHere's an example:nn```html
<asp:ListBox ID="lstData" runat="server" ... />
<asp:Button ID="btnRemoveSelected" runat="server" OnClick="btnRemoveSelected_Click" Text="Remove Selected Items" />
<script>nfunction btnRemoveSelected_Click(sender, args) {n var selectedItems = lstData.get_selecteditems();n for (var i = 0; i < selectedItems.length; i++) {n lstData.items.removeAt(lstData.items.indexOf(selectedItems[i]));n }n}n</script>
```

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More ASP Code Interview Questions

How to Print Asp.net GridView Data on Button Click using Javascript?

1 Answers  


How a web page can communicate with a web server while a user type characters in an input field.

1 Answers  


How to call JavaScript Function from Code-behind in asp.net?

1 Answers  


how to remove or delete multiple selected items from listbox in on button click in asp?

1 Answers  


I'm calling a JS fcn that fires AJAX to a webmethod and returns a boolean. How do I retrieve the return value in the codebehind? (VB) I can set a hiddenfield value in the JS, but if it's async how can my VB know when it's changed?

1 Answers  


Categories
  • PHP Code Interview Questions PHP Code (33)
  • JSP Code Interview Questions JSP Code (6)
  • ASP Code Interview Questions ASP Code (5)
  • CGI Perl Code Interview Questions CGI Perl Code (3)
  • JavaScript Code Interview Questions JavaScript Code (63)
  • VB Script Code Interview Questions VB Script Code (20)
  • Shell Script Code Interview Questions Shell Script Code (31)
  • Python Code Interview Questions Python Code (34)
  • WinRunner Code Interview Questions WinRunner Code (1)
  • HTML DHTML XHTML Code Interview Questions HTML DHTML XHTML Code (13)
  • XML Interview Questions XML (43)
  • Scripts_Markup Code AllOther Interview Questions Scripts_Markup Code AllOther (5)