RadGrid I want to automatically get the coordinates of Row and Column when the mouse cursor is placed on the Cell of RadGrid.

1 Answer 65 Views
Grid
anna
Top achievements
Rank 1
Bronze
Iron
anna asked on 21 Jan 2022, 12:33 PM | edited on 23 Jan 2022, 04:46 PM

 

Attached File : ex.png

telerik:RadGrid (ASP.NET Web)

I want to get the header name of the column clicked by the user with the mouse.

<ClientSettings EnablePostBackOnRowClick="true">  
<Selecting AllowRowSelect="true" /> 
</ClientSettings>   

 protected void RadGrid1_SelectedIndexChanged(object sender, EventArgs e)
        {
            var dataItem = gv.SelectedItems[0] as GridDataItem;
            if (dataItem != null)
            {
                var name = dataItem["ColUniqueName"].Text;
            }
        }
The above source code is not what I want.
Because the user specified ColUniqueName .
I want to automatically get the coordinates of Row and Column&Column HeaderName when the mouse cursor is placed on the Cell of RadGrid.

 

 

It is Example Of FarPoint Spread.
 private void fpSpread1_CellClick(object sender, FarPoint.Win.Spread.CellClickEventArgs e)
 {
      string strTag = fpSpread1.Sheets[0].Columns[e.Column].DataField.ToString();              
}
In FarPoint Spread, There is automatically get the coordinates of Row and Column&Column Header Name when the mouse cursor is placed on the Cell of FarPoint Spread.

 

Please Help Me

1 Answer, 1 is accepted

Sort by
0
Vessy
Telerik team
answered on 24 Jan 2022, 05:55 PM

Hello anna,

The OnSelectedIndexChanged event of RadGrid is specific for the Row selection and it happens upon Postback. That's why you can access only the currently selected data item in it and its columns by unique name.

The cell selection functionality on the other side happens on the client. You can handle the Grid's OnCellSelected client-side event in order to access the header of the selected cell

For example:

            function onCellSelected(grid, args) {
                var selectedColumn = args.get_column();
                var header = selectedColumn.get_element().innerText
                ...
            }

In addition, we would like to kindly ask you to post your questions only once and make sure that the chosen threads are matching the problem chosen by you.

Regards,
Vessy
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
Grid
Asked by
anna
Top achievements
Rank 1
Bronze
Iron
Answers by
Vessy
Telerik team
Share this question
or