Get Selected Row Value In Kendo Grid From The External Button Click Event


This blog tells you how to get the selected row data item from the Grid using external button click event. Fetching the data item from the selected row of Kendo Grid can be easily done using the select function in Kendo Grid. Let us see how.

Please refer to this link to get the basic idea about KendoGrid and its events.


  1. Basic knowledge in Kendo UI framework
  2.  jQuery

Select function in kendo Grid

I have created one sample Grid to demonstrae how to fetch the selected row dataItem using Select function.

Create one new HTML page. In my case, I named it as GridSelect.html. Write the code given below in it.

  1. <!DOCTYPE html>  
  2. <html>  
  3. <head>  
  4.     <meta charset="utf-8"/>  
  5.     <title>Kendo UI Snippet</title>  
  7.     <link rel="stylesheet" href=""/>  
  8.     <link rel="stylesheet" href=""/>  
  9.     <link rel="stylesheet" href=""/>  
  10.     <link rel="stylesheet" href=""/>  
  12.     <script src=""></script>  
  13.     <script src=""></script>  
  14. </head>  
  15. <body>  
  17. <div id="grid"></div>  
  18. <br/>  
  19.   <button type="button" id="btnSelectRow" value="GetValue" class="k-button">Get Row Value</button>  
  20.   <br/>  
  21.   <br/>  
  22.  <b> Product Name:</b> <label id="lblProductName" ></label>  
  23.   <br/>  
  24.   <br/>  
  25.  <b> Category:</b><label id="lblCategoryName"></label>  
  26. <script>  
  27. $("#grid").kendoGrid({  
  28.     selectable: "true",  
  29.     allowCopy: true,  
  30.     columns: [  
  31.         { field: "productName" },  
  32.         { field: "category" }  
  33.     ],  
  34.     dataSource: [  
  35.         { productName: "Tea", category: "Beverages" },  
  36.         { productName: "Coffee", category: "Beverages" },  
  37.         { productName: "Ham", category: "Food" },  
  38.         { productName: "Bread", category: "Food" }  
  39.     ]  
  40. });  
  41.   $("#btnSelectRow").click(function(){  
  43.     var grid = $("#grid").data("kendoGrid");  
  44.         var selectedItem = grid.dataItem(;  
  46.     $("#lblProductName").text(selectedItem.productName);  
  47.     $("#lblCategoryName").text(selectedItem.category);  
  49.   })  
  50. </script>  
  51. </body>  
  52. </html>  

From the above code, you can observe that the button click event is written where we have fetched the data item of the selected row in the Kendo Grid using Select function. From the data item, we have extracted the product name and category and set it to the Product Name and Category Label respectively.

I hope you have enjoyed this blog. Your valuable feedback, questions, or comments about this blog are always welcome.

Build smarter apps with Machine Learning, Bots, Cognitive Services - Start free.

Start Learning Now