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

SelectedItems always returns 0

1 Answer 41 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Robert
Top achievements
Rank 1
Robert asked on 10 Sep 2008, 08:01 AM
Hi,

my RadGrid uses a CheckBox for row selection as descrbed in the documentation. When the CheckBox is clicked, the following Codebehind is executed:
((sender as CheckBox).Parent.Parent as GridItem).Selected = (sender as CheckBox).Checked; 

This line has been taken from the example code in the documentation. Now, I want to perform some action on the selected items. Therefore I use the SelectedItems Property but it always returns 0. I already red this thread: http://www.telerik.com/community/forums/thread/b311D-bdcmhk.aspx
and I belive it should be working ... but for some reason it doesn't. It seems to me, as if the selection is not precessed properly so the CheckBox is checked but the SelectedItems collection is never updated. What's wrong with my code?

Best Regards,
Robert

1 Answer, 1 is accepted

Sort by
0
Sebastian
Telerik team
answered on 12 Sep 2008, 12:13 PM
Hi Robert,

Basically, if you use advanced binding or data source control for grid item generator, the SelectedItems collection should be modified properly to host the selected rows in the grid. You can see that on the following online demo of the product:

http://demos.telerik.com/ASPNET/Prometheus/Grid/Examples/Programming/SelectRowWithCheckBox/DefaultCS.aspx (the selected items are output at the bottom of the grid)

If you are unable to solve the issue yourself, please start a formal support ticket and submit a working version of your project, illustrating the problem. We will examine your complete implementation and will get around to you with our findings.

Best regards,
Stephen
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Grid
Asked by
Robert
Top achievements
Rank 1
Answers by
Sebastian
Telerik team
Share this question
or