This is a migrated thread and some comments may be shown as answers.

Differentiation between setting SelectedItem and mouse click

1 Answer 114 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Heiko
Top achievements
Rank 1
Iron
Veteran
Heiko asked on 26 Mar 2021, 11:42 AM

Hi,

in my GridView I am using the SelectionChanged event. How can I distinguish in this event whether a user has clicked on a row or whether I have set the SelectedItem by code?

Regards
Heiko

1 Answer, 1 is accepted

Sort by
0
Martin Ivanov
Telerik team
answered on 29 Mar 2021, 02:46 PM

Hello Heiko,

The SelectionChanged event fires when a data item is added to the selection (in the SelectedItems colleciton of RadGridView). This can happen in code or by click which propagates the action to the selection feature of the control. In other words, there is no information about the selection trigger. If you want to indicate if the SelectedItem was set by code, you can raise a bool flag each time you set the property in code, and then check the flag's value in the event handler.

Regards,
Martin Ivanov
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
GridView
Asked by
Heiko
Top achievements
Rank 1
Iron
Veteran
Answers by
Martin Ivanov
Telerik team
Share this question
or