Is there currently a way to use DropDownList that would allow a USER to delete an item? We are creating a facility of saved searches and we'd love to be able to allow the user to be able to click an 'X' in a dropdown to trigger a delete of the item from the list (and ultimately the database) as seen in the attached screen shot.
6 Answers, 1 is accepted
You can use a template for the list items and add your Delete button there: https://demos.telerik.com/aspnet-mvc/dropdownlist/template. When clicked, you can fire a request to a service that will perform the actual data source deletion. You can also remove the item from the widget's current data source in this event. You can easily pass arguments (like an ID or value) to the function call by defining them in the markup. Here is a basic example that you can use as base for further development: https://dojo.telerik.com/@bratanov/oDiVABot.
You can also consider the listbox control that offers some built-in commands including a delete command: https://demos.telerik.com/aspnet-mvc/listbox/events.
Regards,
Marin Bratanov
Progress Telerik
My sample was quite basic to just showcase the concept. You can make a prettier template and even use the icons we provide: https://docs.telerik.com/kendo-ui/styles-and-layout/icons-web.
Regards,
Marin Bratanov
Progress Telerik
Marin, your dojo demo doesn't seem to be valid anymore? https://dojo.telerik.com/@bratanov/oDiVABot. keeps telling me there was an error on the page. I had to put this work aside for a while and now I'm ready to revisit it.
Thanks, Mike!
The Dojo example that my colleague Marin provided is working correctly on my end. In any case, I have create a duplicate example that you can use:
I am also attaching a .zip archive that contains a simple HTML page, where the contents from the Dojo is also available.
Regards,
Dimitar
Progress Telerik