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

Retrieve the value of a field grid server side with the action RowSelected

I need to retrieve the value of a server-side field with the Grid (RowSelected action).
With the Gridview control of VS2015 I used:

Dim row As GridViewRow = GridView1.SelectedRow
CHIAVE = row.Cells(x).Text

Could you give me some help?

1 Reply

GV Gowthami V Syncfusion Team April 27, 2016 11:25 AM UTC

Hi Roberto,  
Thanks for contacting Syncfusion support.  
Essential ASP.NET Grid uses client side rendering, so we can’t access the selected row element (TR element) in server side. But, we can get the selected records and row index information at server side by using the Grid Server Side events. Refer to the sample and code example as below.  
Sample: Sample-VB-155885  
<ej:Grid ID="Grid1" runat="server" AllowPaging="True" OnServerRowSelected="Grid1_ServerRowSelected">  
            <ej:Column Field="OrderID" HeaderText="Order ID" IsPrimaryKey="true" TextAlign="Right"Width="90" />  
            <ej:Column Field="CustomerID" HeaderText="Customer ID" Width="100" />  
            <ej:Column Field="EmployeeID" HeaderText="Employee ID" HeaderTemplateID="#employeeTemplate"TextAlign="Right" Width="110" />  
            <ej:Column Field="Freight" HeaderText="Freight" TextAlign="Right" Width="90" Format="{0:C}"/>  
            <ej:Column Field="OrderDate" HeaderText="Order Date" Width="100"HeaderTemplateID="#dateTemplate" TextAlign="Right" Format="{0:MM/dd/yyyy}" />  
            <ej:Column Field="ShipCity" HeaderText="Ship City" Width="100" />  
[Code behind]  
Protected Sub Grid1_ServerRowSelected(sender As Object, e As Syncfusion.JavaScript.Web.GridEventArgs)  
        Dim data As Dictionary(Of String, Object) = DirectCast(e.Arguments("data"), Dictionary(Of String,Object))  
        Dim CustomerID As String = ""  
        For Each items As KeyValuePair(Of String, Object) In data  
            If items.Key = "CustomerID" Then  
                CustomerID = items.Value.ToString()  
            End If  
    End Sub   
Refer to the help document and screenshot as below. 
Gowthami V. 

Live Chat Icon For mobile
Up arrow icon