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

How to find out if full row is selected with SelectionMode="Extended"

2 Answers 76 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Jan
Top achievements
Rank 1
Jan asked on 01 Jul 2019, 10:56 AM

In my gridview I want to prevent the user from deleting entire rows but allow to delete (multiple cells) by pressing the DEL-key. Works fine so far but how can I prevent that the user accidentally selectes multiple rows and presses delete. So far I just count the number of selected fields for delete and show a warning but there's got to be a nicer way.

Is there any property in the radgridview that tells me, if multiple rows are selected?

Row selection as such is needed for copy/paste so removing anything is not an option.

 

thanks for your help in advance!

Jan

2 Answers, 1 is accepted

Sort by
0
Dinko | Tech Support Engineer
Telerik team
answered on 03 Jul 2019, 11:34 AM
Hi Jan,

The control does not expose such property which holds how many rows are selected. What I can suggest you is to used the SelectedItems collection of the control. You can use the Count property of the collection to get how many rows are selected.
var selectedRows = this.MyRadGridView.SelectedItems.Count;

Give this approach a try and let me know if it works for you.

Regards,
Dinko
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Jan
Top achievements
Rank 1
answered on 03 Jul 2019, 12:31 PM

Works like a charm. 

thank's Dinko!

Tags
GridView
Asked by
Jan
Top achievements
Rank 1
Answers by
Dinko | Tech Support Engineer
Telerik team
Jan
Top achievements
Rank 1
Share this question
or