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

Deselect dinamically Grid's items

3 Answers 85 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Andrea D'Orio
Top achievements
Rank 1
Andrea D'Orio asked on 03 Mar 2009, 11:31 AM
Hi,
I need to deselect all items selected of a Grid from c# code (not javascript).
i try to deselect through:

for (int i = 0; i < RadGrid1.SelectedItems.Count; i++)
{

   RadGrid1.SelectedItems[i]
.Selected = false;
}

RadGrid1.Rebind();

But deselect only a first row selected. Are there other way?

Thanks in advance
Andrea

3 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 03 Mar 2009, 12:22 PM
Hello Andrea,

You can loop through the selected items of the grid and deselect the items as shown below:
cs:
 protected void Button1_Click(object sender, EventArgs e) 
    { 
        foreach (GridDataItem dataItem in RadGrid1.SelectedItems) 
        { 
            dataItem.Selected = false
        } 
    } 

Thanks
Princy.

0
Daniel
Telerik team
answered on 03 Mar 2009, 12:38 PM
Hello Andrea,

Yet another possible approach:
protected void Button1_Click(object sender, EventArgs e) 
    RadGrid1.SelectedIndexes.Clear(); 

Regards,
Daniel
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Andrea D'Orio
Top achievements
Rank 1
answered on 03 Mar 2009, 01:38 PM
Thanks! Works in both case

Andrea
Tags
Grid
Asked by
Andrea D'Orio
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Daniel
Telerik team
Andrea D'Orio
Top achievements
Rank 1
Share this question
or