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.
Unfortunately, activation email could not send to your email. Please try again.

Control Gird

Thread ID:

Created:

Updated:

Platform:

Replies:

129760 Apr 2,2017 01:11 PM Apr 5,2017 08:34 AM ASP.NET Web Forms 5
loading
Tags: Grid
emanuele
Asked On April 2, 2017 01:11 PM

Hi,

I have two points:


1. I want to get a row values by row index in Grid. 
2. In toolBox in grid I want  connect add and edit button with my custom function in server side. can I do that?

thanks
Emanuele


Alan Sangeeth S [Syncfusion]
Replied On April 3, 2017 03:06 AM

Hi Emanuele, 

Thanks for using Syncfusion products. 

Query 1: “get a row values by row index in Grid 
You can get the row element using getRowbyIndex method of Grid. Please refer the following API documentation link. 
If you need to get the JSON data, you get it by using “getDataByIndex” method of Grid. Please refer the following link. 

Query 2: “ connect add and edit button with my custom function in server side 
We suspect that you need to connect CRUD operation in Grid with server-side and you can achieve it using OnServerAddRow, OnServerEditRow, OnServerDeleteRow Grid events. Please refer to the following documentation for details regarding server-side interaction during CRUD operations. 

Suppose if you need to add customized buttons in grid toolbar, please refer the following documentations. 

Regards,
Alan Sangeeth S 


emanuele
Replied On April 3, 2017 03:29 AM

Sorry, I didn't explain very well, for the first problem: I want get select row data in ServerToolBarClick events, and don't from JS.

For the second point, ok I understand that there isn't event before add.

Thanks
Emanuele

Alan Sangeeth S [Syncfusion]
Replied On April 4, 2017 06:14 AM

Hi Emanuele, 
 
Using the SelectedRowIndex and PageSettings property of Grid, we can get the selected row data from Grid DataSource property in server side. Please refer the following code example. 
protected void Toolbar_Click(object sender, Syncfusion.JavaScript.Web.ButtonEventArgs e) 
        { 
             
            var selectedRowIndex = this.Grid1.Model.SelectedRowIndex; // here you will get SelectedRow index 
            int dataIndex; 
            if (this.Grid1.PageSettings.CurrentPage > 1) 
  
                dataIndex = (this.Grid1.Model.PageSettings.PageSize * (this.Grid1.Model.PageSettings.CurrentPage - 1)) + (selectedRowIndex); 
            else 
                dataIndex = selectedRowIndex; 
            var DataSource = this.Grid1.Model.DataSource; 
              
            JavaScriptSerializer mySerialiser = new JavaScriptSerializer(); 
            string sJSONOutput = mySerialiser.Serialize(DataSource); 
            var data = mySerialiser.Deserialize<IEnumerable<Orders>>(sJSONOutput); // here you will get all the records 
  
            var SelectedRow = data.ElementAt(dataIndex); // here you will get SelectedRow 
  
            var keyValue = SelectedRow.OrderID;  // here you will get selected RowKey value 
  

Regards,
Alan Sangeeth S 


emanuele
Replied On April 4, 2017 05:12 PM

Hi, But how you see in screenshot the datasource  is null in grid. I don't understand why?I use datasourceobject and maybe it is the problemAttachment: ScreenShot_20170404230745_47055fb2.zip

Venkatesh Ayothi Raman [Syncfusion]
Replied On April 5, 2017 08:34 AM

Hi Emanuele, 
Thanks for the update. 
We have reproduced this issue while using object data source and using Essential Studio older version. In our latest version, the reported issue is not reproduced at our end. So, could you please ensure whether you are using older Essential Studio version? If so, we suggest you to upgrade the latest Essential Studio version. 
We have also prepared a sample for your convenience which can be download from following link, 
Note: in this sample, we have used the latest Essential Studio CDN links. 
 Regards, 
Venkatesh Ayothiraman. 


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.

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.

;