Is there any way to make multiselect clickable

1 Answer 80 Views
MultiSelect
Amr
Top achievements
Rank 1
Iron
Amr asked on 26 Oct 2022, 10:20 AM
Please can you advice if there is a way to enable 
  1. Components/
  2. MultiSelect/ to be clickable.

 

Thanks,

 

1 Answer, 1 is accepted

Sort by
0
Mihaela
Telerik team
answered on 31 Oct 2022, 09:04 AM

Hello Amr,

You can attach an onClick event to each MultiSelect item by using the TagTemplate() method:

@(Html.Kendo().MultiSelect()
  .Name("customers")
  .DataTextField("ContactName")
  .DataValueField("CustomerID")
    ...
   .TagTemplate("<span class=\"selected-value\" onclick='#=myFunction(data.ContactName)#'>#: data.ContactName #</span>")
 )

<script>
    function myFunction(itemName) {
        console.log("item clicked");
        console.log(itemName);
    }
</script>

REPL example:

https://netcorerepl.telerik.com/mclYHFON00lsdqhp27

Let me know if this is the result you aim to achieve.

 

Regards, Mihaela Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
MultiSelect
Asked by
Amr
Top achievements
Rank 1
Iron
Answers by
Mihaela
Telerik team
Share this question
or