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

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

Thread ID:

Created:

Updated:

Platform:

Replies:

123843 Apr 26,2016 12:01 PM UTC Apr 27,2016 11:25 AM UTC ASP.NET Web Forms 1
loading
Tags: Grid
ROBERTO CICALA
Asked On April 26, 2016 12:01 PM UTC

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?

Gowthami V [Syncfusion]
Replied On 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">  
        <Columns>  
            <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" />  
        </Columns>  
    </ej:Grid>   
  
[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  
        Next  
    End Sub   
  
Refer to the help document and screenshot as below. 
  
 
Regards,  
 
Gowthami V. 



CONFIRMATION

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.

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

;