This is a migrated thread and some comments may be shown as answers.

Dropdownlist Delete Item

6 Answers 386 Views
DropDownList
This is a migrated thread and some comments may be shown as answers.
Michael
Top achievements
Rank 1
Michael asked on 15 Aug 2018, 05:40 PM

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

Sort by
0
Accepted
Marin Bratanov
Telerik team
answered on 16 Aug 2018, 12:17 PM
Hi Michael,

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
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Michael
Top achievements
Rank 1
answered on 16 Aug 2018, 01:44 PM
Thanks Marin, the example helped a lot.  The UI is a little strange, I would of liked to have seen an actual delete button in the template, but I understand how to make it work the way I need it, so thank you!
0
Marin Bratanov
Telerik team
answered on 16 Aug 2018, 03:10 PM
Hi Michael,

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
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Michael
Top achievements
Rank 1
answered on 16 Aug 2018, 03:14 PM
Marin, thank you so much for that link!  The list of all kendo icons is huge!
0
Michael
Top achievements
Rank 1
answered on 29 Aug 2018, 02:46 PM

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!

0
Dimitar
Telerik team
answered on 31 Aug 2018, 10:26 AM
Hello Michael,

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
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
DropDownList
Asked by
Michael
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
Michael
Top achievements
Rank 1
Dimitar
Telerik team
Share this question
or