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

Rows Select

Thread ID:





124613 Jun 17,2016 07:53 AM UTC Jun 22,2016 10:05 AM UTC ASP.NET Web Forms 5
Tags: Grid
Hrvoje Voda
Asked On June 17, 2016 07:53 AM UTC

I would like to get values from selected row into textbox.

Gowthami V [Syncfusion]
Replied On June 20, 2016 12:33 PM UTC

Hi Hrvoje, 
Thanks for contacting Syncfusion support. 
We can get the selected records using “getSelectedRecords” method in client side as follows, 
<ej:Grid ID="FlatGrid" runat="server" AllowSorting="True"> 
. . . .  
  <script type="text/javascript"> 
            text: "set text value in client side", 
            click: function (args) { 
                var gridObj = $('#<%= FlatGrid.ClientID %>').ejGrid('instance'); 
                var d = gridObj.getSelectedRecords()[0]; 
Please refer to the below link for more clarification about getSelectedRecords, 
If you need get the selected row details in RowSelected server side event then refer the below code example, 
  <ej:Grid ID="FlatGrid" runat="server" AllowSorting="True" AllowPaging="True" OnServerRowSelected="FlatGrid_ServerRowSelected"> 
.  . . . 
protected void FlatGrid_ServerRowSelected(object sender, GridEventArgs e) 
            int selectedrowindex = Convert.ToInt32(e.Arguments["rowIndex"]); 
            int id; 
            Dictionary<string, object> data = e.Arguments["data"] as Dictionary<string, object>; 
            foreach (KeyValuePair<string, object> keyval in data) 
                if (keyval.Key == "EmployeeID") 
                    id = Convert.ToInt32(keyval.Value); 
                    TextBox1.Text = id.ToString(); 
For your convenience we have created a sample and the same can be downloaded from the following link, 
If we misunderstood your requirement please provide us below details, 
1.       Share the detailed explanation of your requirement. 
2.       Screenshot of the requirement. 
The provided information will help to analyze the requirement and provide you the response as early as possible. 
Gowthami V. 

Hrvoje Voda
Replied On June 21, 2016 11:25 AM UTC

This works fine, but I have grid as userControl.
So, I want to get values from Grid.SelectedIndex number...without knowing column name..
Is that possible?

Hrvoje Voda
Replied On June 21, 2016 11:53 AM UTC

I found the solution.
All I need is to raise an event and send data dictionary values.

Hrvoje Voda
Replied On June 21, 2016 12:15 PM UTC

There is only one problem.
After selected row grid is refreshing and return no data.
How can I prevent grid from refresh?
I put update panel but it doesn't work.

Gowthami V [Syncfusion]
Replied On June 22, 2016 10:05 AM UTC

Hi Hrvoje, 
Query: After selected row grid is refreshing and return no data. 
We are able to reproduce the issue while bind the data to the grid under Page_Load method with checking condition as !IsPostBack as below, 
protected void Page_Load(object sender, EventArgs e) 
            if (!IsPostBack) {  
                this.FlatGrid.DataSource = OrderRepository.GetAllRecords().ToList(); 
While refreshing the page the !IsPostBack condition get failed and not set the data to the grid. So that only the grid rendered with no data. 
If you are facing same issue that data not bound while post back, then we can resolve the issue by set DataSourceCachingMode as “ViewState” or “Sessionwhich is used to cache data on page postback. 
Refer to the below code example, 
  <ej:Grid ID="FlatGrid" runat="server" DataSourceCachingMode="ViewState"> 
. . . . 
. . . . 
To avoid the page refresh while post back then we can render the grid inside update panel.  
We have created a sample based on your requirement and the same can be downloaded from the following link, 
Gowthami V. 


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