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

mvc List view clicked item

I want to trap the click event of list view item and use the primarykey to make a ajax call how to do

1 Reply

SS Selvamani Sankarappan Syncfusion Team April 20, 2016 11:48 AM UTC

Hi Vivek,

Thanks for Contacting Syncfusion Support,

We have analyzed your query. You can achieve your requirement by using existing clientSideEvent “mouseUp” in ListView component. Get the PrimaryKey value in args and use the key value in Ajax call function. Please refer the following code example:

[cshtml]

@Html.EJ().ListView("listview").ShowHeader(true).FieldSettings(f => f.Text("texts").PrimaryKey("PrimaryKeys")).ClientSideEvents(s=>s.MouseUp("action")).DataSource(Model)


[script]

function action(args) {

        var key = args.itemData.PrimaryKeys; // get the primarykey value

        var text = args.itemData.texts;

        console.log("" + key);

        console.log("" + text);

    }


We have prepared the sample based on this. Please get the sample from the following location:

http://www.syncfusion.com/downloads/support/forum/123759/ze/splitterMVC-670476672

Regards,

Selvamani S


Loader.
Live Chat Icon For mobile
Up arrow icon