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

Getting the index of a StackedHeaderRow (SfDataGrid).


How to get the index of a StackedHeaderRow?

e.DataColumn is null

error -21.11.2022.jpg


8 Replies 1 reply marked as answer

DM Dhanasekar Mohanraj Syncfusion Team November 22, 2022 03:01 PM UTC

Hi Ehs psy,

This requirement can be achievable by using the SfDdataGrid.CellClick event is shown below,

this.sfDataGrid1.CellClick += OnCellClick;

private void OnCellClick(object sender, CellClickEventArgs e)


    int rowIndex = e.DataRow.RowIndex;


Here we have prepared the sample based on your scenario, please have a look at this. Could you please confirm if we missed anything?

If this post is helpful, please consider Accepting it as the solution so that other members can locate it more quickly.

Attachment: Sample_f9c93c80.zip

EP ehs psy November 23, 2022 08:56 AM UTC

Hi  Dhanasekar Mohanraj;

what i want is the column index not just the row index.I need to click on the different headers(

Stacked Headers).

that's why i sed that  e.DataColumn returns null.

thanks for the reply.

DM Dhanasekar Mohanraj Syncfusion Team November 24, 2022 02:39 PM UTC

Ehs psy,

We have checked the reported issue on our end. In that, the DataColumn does not return as null its works properly as expected. Here, we have attached the tested video demo for your reference. Please have a look at this. Could you please confirm if we missed anything? If you are still facing the reported issue, modify the attached sample and share the video illustration of the reported issue. It will be helpful for us to check on it and provide you with a solution at the earliest.

Attachment: TestedVideo_ca187c19.zip

EP ehs psy replied to Dhanasekar Mohanraj November 27, 2022 08:08 AM UTC


The problem shows just when you try to get the index value for an StackedHeaderRow header.

error (2).jpg


VD Vasanthkumar Durairaj Syncfusion Team November 28, 2022 02:12 PM UTC

We have created a bug report for the reported issue “DataColumn is null in the DataGrid CellClick event when clicking in the StackedHeaderColumn ”. So, We will fix this issue and include it in our first NuGet release after the Essential Studio 2022 Volume 4 release.


You can track the status of this report through the following feedback link,


Feedback Link:  https://www.syncfusion.com/feedback/39430/datacolumn-is-null-in-the-datagrid-cellclick-event-when-clicking-in-the

Note: The provided feedback link is private, and you need to login to view this feedback.


We will let you know once it is released. We appreciate your patience until then.

EP ehs psy replied to Vasanthkumar Durairaj November 29, 2022 08:38 AM UTC

Hi Durairaj ;

The column header graphical anomaly still exists as well.

It appears after filtering.


error -29.11.2022.jpg

DM Dhanasekar Mohanraj Syncfusion Team November 30, 2022 04:16 PM UTC

Ehs psy,

We have created the new forum under SfDataGrid control because the mentioned query is not related to the previously mentioned query. We request you have a further follow-up with that forum 179169.

DM Dhanasekar Mohanraj Syncfusion Team December 30, 2022 10:31 AM UTC

Ehs psy,

We would like to let you know that Essential Studio Weekly NuGet packages (v20.4.0.41) have been published in nuget.org with the fix for the issue DataColumn is null in the DataGrid CellClick event when clicking in the StackedHeaderColumn. Please let us know if you have any concerns about this.

Marked as answer
Live Chat Icon For mobile
Up arrow icon