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

What is the best way to access RowData in OnCurrentCellBeginEdit event with group columns

Thread ID:





119619 Jul 15,2015 01:19 PM UTC Jul 18,2015 02:52 PM UTC WinRT 3
Tags: SfDataGrid
Asked On July 15, 2015 01:19 PM UTC

I have a data grid with Group columns. I am using OnCurrentCellBeginEdit event to restrict write access to some cells based underneath row data values. Here is the code I am using inside OnCurrentCellBeginEdit  event:

if (args.Column.MappingName.Equals("Name"))
   var rowIndex = MyGrid.ResolveToRecordIndex(args.RowColumnIndex.RowIndex);
   var rowData = (MyGrid.View.Records[rowIndex]).Data as Student

   if (rowData.Discontinued)
      args.Cancel = true;

Problem is rowData returned is not the row inwhich I clicked on Name cell, I am guessing its because of the grouping row. What is the best way to correctly access RowData in OnCurrentCellBeginEdit   event. Please let me know.

Note: Both args.RowColumnIndex.RowIndex & MyGrid.ResolveToRecordIndex(args.RowColumnIndex.RowIndex) doesnt work well.

Jai Ganesh S [Syncfusion]
Replied On July 16, 2015 12:27 PM UTC

Hi Vasanth,

Thank you for using Syncfusion products.

We have analyzed your query. You can achieve your requirement like getting the row data from DisplayElements in grouping case by using the corresponding resolved record index.

Code Snippet [C#]:

void datagrid_CurrentCellBeginEdit(object sender, CurrentCellBeginEditEventArgs args)


            if (args.Column.MappingName.Equals("EmployeeName"))


                   var recordIndex = datagrid.ResolveToRecordIndex(args.RowColumnIndex.RowIndex);

                   if (this.datagrid.View.TopLevelGroup != null)


                       // Get the current row record while grouping

                       var record = this.datagrid.View.TopLevelGroup.DisplayElements[recordIndex];

                       // data of record as type cast to OrderInfo

                       var rowData = (record as RecordEntry).Data as BusinessObjects;

                       if (rowData.EmployeeName == "Mart")

                           args.Cancel = true;




                       // Get the current row record

                       var record1 = this.datagrid.View.Records.GetItemAt(recordIndex);

                       if ((record1 as BusinessObjects).EmployeeName == "Mart")

                           args.Cancel = true;




We have also prepared the sample based on this and please find the sample under the following location,

Sample: http://www.syncfusion.com/downloads/support/directtrac/141139/ze/SfDataGridDemo227932121

KB Link:


Please let us know if you need further assistance.

Thank you,

Jai Ganesh S

Replied On July 16, 2015 01:55 PM UTC

perfect, works like a champ. thank you!

Antony Raj M [Syncfusion]
Replied On July 18, 2015 02:52 PM UTC

Hi Vasanth,

Thanks for your update. Please let us know if you need further assistance on this.

Antony Raj


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