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

Get selected row values of any column

Thread ID:





124596 Jun 16,2016 07:54 AM UTC Jun 29,2016 11:37 AM UTC ASP.NET Web Forms 8
Tags: Grid
Asked On June 16, 2016 07:54 AM UTC


i cannot find an answer to the easiest question.
How to get the value of a particular column in a selected grid row in vb.net?

Isuriya Rajan [Syncfusion]
Replied On June 17, 2016 09:28 AM UTC

Hi Pratura,   
  Thanks for contacting Syncfusion support,   
  We can achieve your requirement by using getSelectedRecords method. Here, we have used RowSelected grid event to get selected row values.   
<ej:grid ID="gvAlumnos" runat='server' AllowPaging="True">   
        <ClientSideEvents RowSelected ="rowSelect" />   
           <ej:Column  Field="CustomerID" HeaderText="CustomerID" Width="75" />   
           <ej:Column  Field="OrderID" HeaderText="OrderID" />                                       
function rowSelect() {   
          var obj = $("#MainContent_gvAlumnos").ejGrid("instance");   
     //getSelectedRecords method will display the selected row in a grid    
Please refer to the below sample and documentation link on how to get selected row values.   
Isuriya R.   

Replied On June 17, 2016 09:30 AM UTC


Thank you.
I need it in JS also, but my original question was how to get the value from a grid row in VB.NET code  when i'm calling the server side function.

Thank you

Isuriya Rajan [Syncfusion]
Replied On June 20, 2016 10:35 AM UTC

Hi Pratura,   
To get the value from a grid row in VB.NET code and JS, you have to use theRowSelected event. Please find the below code snippets.   
You can also use OnServerRowSelected server-side event of the Grid. Please find the code example.   
<ej:grid ID="gvAlumnos" runat='server' AllowPaging="True"  
          AllowGrouping="true"  OnServerRowSelected="gvAlumnos_ServerRowSelected"> 
                <ej:Column  Field="CustomerID" HeaderText="CustomerID" Width="75" /> 
                <ej:Column  Field="OrderID" HeaderText="OrderID" /> 
                <ej:Column  Field="EmployeeID" HeaderText="EmployeeID" Width="75" /> 
                <ej:Column  Field="ShipCity" HeaderText="ShipCity" Width="75" /> 
Protected Sub gvAlumnos_ServerRowSelected(sender As Object, e As Syncfusion.JavaScript.Web.GridEventArgs) 
        Dim selectedrowindex As Integer = Convert.ToInt32(e.Arguments("rowIndex")) 
        Dim id As Integer 
        Dim data As Dictionary(Of String, Object) = TryCast(e.Arguments("data"), Dictionary(Of String, Object)) 
        For Each keyval As KeyValuePair(Of String, Object) In data 
            If keyval.Key = "EmployeeID" Then 
        //find the EmployeeID column value.  
                id = keyval.Value 
            End If 
    End Sub 

The OnServerRowSelected event helps to get the selected ones in the server side.   
Please find the attached samples in VB.net below:   
We have achieved your requirement by using rowSelected event of the ejGrid. Please find the below code snippets.   
              dataSource: data, 
              allowPaging: true, 
              allowSorting: true, 
              columns: [ 
                       { field: "OrderID", headerText: "Order ID", width: 75, textAlign: ej.TextAlign.Right }, 
                       { field: "CustomerID", headerText: "Customer ID", width: 80 }, 
            //client side event 
              rowSelected: "rowSelected", 
function rowSelected() {    
          var obj = $("#Grid").ejGrid("instance");    
     //getSelectedRecords method will display the selected row in a grid     
The “rowSelected” event helps to getSelected in client side.   
 Please find the below attached samples and Online Documentation link about getSelectedRecords and rowSelected events.   
Documentation link for getSelectedRecords: http://help.syncfusion.com/js/api/ejgrid#methods:getselectedrecords 
Documentation link for rowSelected: http://help.syncfusion.com/js/api/ejgrid#events:rowselected   

Isuriya  R.   

Replied On June 27, 2016 12:45 PM UTC

Thank you.

Is there a way to get the selected item value in vb.net without using the event and iterating through the whole set of data every time a row is selected?
Rather just clicking on a button and getting the value in the form of Me.Grid1.SelectedRows(0).Column(0).Value (i know those methods and properties don't exist, just an example)

Mohammed Farook J [Syncfusion]
Replied On June 28, 2016 07:45 AM UTC

Hi Pratura, 
Sorry for inconvenience caused. 
We have validated your requirement , currently we don’t have support directly get selected value through method in server side . So We suggest to use  the selected values are stored in global variable through ServerRowSelected” event of Grid and you can get selected valued from the global variable . please find the code example 
[code behind] 
Public Class _Default 
    Inherits System.Web.UI.Page 
    Dim Shared selectedData  'global  variable declaration  
    Protected Sub Submit(sender As Object, e As EventArgs) 
   Dim selectedRows As Object 
        selectedRows = selectedData 'global  variable resue 
    End Sub 
    Protected Sub gvAlumnos_ServerRowSelected(sender As Object, e As Syncfusion.JavaScript.Web.GridEventArgs) 
        Dim selectedrowindex As Integer = Convert.ToInt32(e.Arguments("rowIndex")) 
        Dim id As Integer 
        Dim data As Dictionary(Of String, Object) = TryCast(e.Arguments("data"), Dictionary(Of String, Object)) 
        For Each keyval As KeyValuePair(Of String, Object) In data 
            If keyval.Key = "EmployeeID" Then 
                id = keyval.Value 
            End If 
        selectedData = data 
    End Sub 
End Class 
   <asp:Button ID="selectRow" runat="server" OnClick=" Submit" Text="getSelectedRecords" /> 
                      <ej:grid ID="gvAlumnos" runat='server' AllowPaging="True"  
. . . 
In above code example we have stored selected values in global  variable  through “RowSelected” event of Grid . when get the selected Rows through global  Variable as “selectedData”.  Please find the screen shot. 
Get selected data from “RowSelected” event of Grid and its stored in Global  variable as SelectedData. 
Get selected rows data from global variable when click external button : 
J.Mohammed Farook 

Replied On June 28, 2016 11:58 AM UTC

Thank you.

The code works, the problem now is that whenever i click on a row the page refreshes.
I tried putting the grid in the update panel too, it didn't help.

Also, when the page is refreshed the grid is not shown anymore.
The page is blank, since i only have the grid on the page.

On the server side when debugging, prior to refresh, the selectedrow event captures the data just as it should.

Replied On June 29, 2016 07:59 AM UTC

I have moved to client side selected row and passing the data with ajax
The server side event was not satisfactory.

Everything works now.
Thank you for your help.

Venkatesh Ayothi Raman [Syncfusion]
Replied On June 29, 2016 11:37 AM UTC

Hi Pratura, 

Thanks for the update. 
The reported issue was reproduced in previous version ( only when using custom toolbar items in Grid. So, please ensure your version. If you are using old version of Essential studio then upgrade to the Latest version of Essential studio from the following link,   

Refer the following steps to upgrade your project to our latest version. 
1. Please download and Install the Essential Studio latest version. 
2. Replace the Syncfusion latest version scripts and CSS in your project from the following location. 
Scripts and CSS: [installed Location]\Syncfusion\Essential Studio\XX.X.X.XX\JavaScript\assets 
3. We have listed the required Namespaces, DLLs, script and CSS files to work with the ASP.Net MVC Control. So we need to replace all the following files as a latest one. 
Script files 
Syncfusion script files: 
External Script files: 
CSS files 
You can find the scripts and css files in the following locations: 
Script Location: [installed Location]\Syncfusion\Essential Studio\\JavaScript\assets\scripts\web   
CSS Location: [installed Location]\Syncfusion\Essential Studio\\JavaScript\assets\css\web   
DLL Location[installed Location]\Syncfusion\Essential Studio\\Assemblies   
4. Please refer to the latest version ( of required DLLs in your project and change the referred version in project Web.config file which is located under the project’s root directory.   
<compilation debug="true" targetFramework="4.5" > 
                <add assembly="Syncfusion.EJ, Version= 14.2400.0.26, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89" /> 
                <add assembly="Syncfusion.EJ.Web, Version= 14.2400.0.26, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89" /> 
5. Clear the browser cache, before you run the upgraded project.   

You can also use server side row selected event by upgrading to the Essential studio latest version. We are happy to hear that your requirement is achieved. 
Venkatesh Ayothiraman. 


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