We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Bind Custom Events to ListView Component

Platform: ASP.NET MVC |
Control: ListView |
Published Date: September 18, 2018 |
Last Revised Date: September 18, 2018

In ListView component, we have multiple events like actionBegin, actionComplete, actionFailure and select to interact with ListView.

We can interact with ListView items using select event which will be get triggers while we are selecting a list item. As like ListView select event, we can bind custom events like double click to interact with the list items.

Here we bind the doubleclick event to the parent element of the list items with the help of addEventListener method in actionComplete event of ListView Component. In the double click event we have displayed the selected item text.

Refer to the below code snippet to bind custom events in ListView.

    function onActionComplete() {

  listObj.element.getElementsByClassName('e-content')[0].addEventListener("dblclick", onDoubleClick.bind(this));

  } 

     function onDoubleClick(args) {

        var selectedItem = listObj.getSelectedItems();

        document.getElementById('val').innerHTML = 'You have clicked <b>'+selectedItem.text+'</b> twice';

    }

 

 

Refer to the below sample link.

Sample

2X faster development

The ultimate ASP.NET MVC UI toolkit to boost your development speed.
ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile