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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How do I attach a Client side event on selection of a row on Grid?

Thread ID:





127935 Dec 20,2016 11:34 AM UTC Dec 21,2016 09:13 AM UTC ASP.NET Core 2
Tags: Grid
Samved Thakkar
Asked On December 20, 2016 11:34 AM UTC

I want to be able to call a Client side event i.e. a java script function when you select a row on Grid and in get the values for the selected row.

How do I do this? I couldn't find an example on your website.


Samved Thakkar
Replied On December 20, 2016 11:42 AM UTC

Also, how do I get the values of the selected row of a grid on a separate button's client side event? 

Mani Sankar Durai [Syncfusion]
Replied On December 21, 2016 09:13 AM UTC

Hi Samved, 

Thank for contacting Syncfusion support. 

We have analyzed your query and we can get the selected records value using getSelectedRecords method or rowSelected events in grid. Please refer the documentation link. 

Please refer the below code example. 
<button id="btn" onclick="myFunction()">get selected row value</button> 
<ej-grid id="Grid" datasource=ViewBag.data allow-paging="true" row-selected="rowselected" > 
<script type="text/javascript"> 
    function rowselected(args) { 
        var grid = $("#Grid").ejGrid("instance"); 
        var rowdata = args.data;   // get the selected value using args.data in rowSelected event 
        var rowindex = args.rowIndex; 
        var rowdata1 = this.getSelectedRecords();  //also we can get it by using getSelectedRecords method in grid and ‘this’ keyword refers to grid instance. 
    function myFunction() { 
                     //getting the value by using external button 
        var grid = $("#Grid").ejGrid("instance");     // create a grid instance 
        if (grid.getSelectedRows().length) 
        alert(JSON.stringify(grid.getSelectedRecords()[0]));   //we can get it by using getSelectedRecords method in grid  

We have also prepared a sample that can be downloaded from the below link. 

Also please refer the following KB link: 

Please let us know if you need further assistance. 

Manisankar Durai. 


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

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

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