WPF RadGridView Delete row via

1 Answer 71 Views
Buttons GridView
Elias
Top achievements
Rank 1
Iron
Elias asked on 03 Apr 2024, 11:25 PM
Is there a way to delete all rows inside a RadGridView after a button event has been pressed?
The documentation shows how to delete the row/rows via keyboard(from a user) or manually but didn't found via code

Example: The user presses a button that deletes all text inside textboxes including the rows data inside the RadGridView

1 Answer, 1 is accepted

Sort by
1
Accepted
Martin Ivanov
Telerik team
answered on 04 Apr 2024, 02:52 PM

Hello Elias,

To delete all rows on button click, you can clear the collection assigned as ItemsSource of RadGridView. For example:

var source = this.gridView.ItemsSource as MyCollectionTypeHere;
source.Clear();
// or 
this.radGridView.ItemsSource = null;

Regards,
Martin Ivanov
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Elias
Top achievements
Rank 1
Iron
commented on 10 Apr 2024, 12:43 PM

Thanks a lot, I notice can use
this.radGridView.Items.Clear()

For clearing the entire collection
Tags
Buttons GridView
Asked by
Elias
Top achievements
Rank 1
Iron
Answers by
Martin Ivanov
Telerik team
Share this question
or