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

Delete Checked gridview rows

3 Answers 87 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
aubrey
Top achievements
Rank 1
aubrey asked on 02 May 2011, 07:39 AM
hi! can you help me with this one?


i have a datagrid with 2 columns: a checkbox and a string binded to a datamember.
when i check the header checkbox, it should check all checkboxes on each rows.
i want to delete the checked rows... how can i do that?


here's my code:


//xaml
<telerik:RadGridView Name="GridView_List" GIsFilteringAllowed="False" AutoGenerateColumns="False" SelectionMode="Extended">
    <telerik:RadGridView.Columns>
        <telerik:GridViewSelectColumn />
        <telerik:GridViewDataColumn Header="Gridview Style" DataMemberBinding="{Binding FilterName}"/>
    </telerik:RadGridView.Columns>
</telerik:RadGridView



//.cs
namespace ReportsUIScreens
{
    public partial class GridviewSetting_List : ChildWindow
    {
        private List<filterHistory> histList;
        public GridviewSetting_List(List<filterHistory> histListLink)
        {
            InitializeComponent();
            histList = histListLink;
            this.GridView_List.ItemsSource=histList;
        }
         
        private void DeleteButton_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            //here's where i want to delete the checked row(s)
        }
    }
}

i badly needed this one. please reply. Y_Y

3 Answers, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 02 May 2011, 07:43 AM
Hello aubrey,

Generally, the IsChecked property of each of the CheckBox-es in the GridViewSelectColumn is bound to the IsSelected property of the corresponding row. So, you may run through the SelectedItems collection and remove the items in it from the source of the grid.
 

Regards,
Maya
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
aubrey
Top achievements
Rank 1
answered on 02 May 2011, 08:00 AM
Hi Maya,

thanks a lot! you save me.. :) 

best regards,
Aubrey
0
loraine
Top achievements
Rank 1
answered on 02 May 2011, 01:58 PM
i also have the same problem.. can you please give the code for the DeleteButton_Click?..
please
Tags
GridView
Asked by
aubrey
Top achievements
Rank 1
Answers by
Maya
Telerik team
aubrey
Top achievements
Rank 1
loraine
Top achievements
Rank 1
Share this question
or