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

[Solved] Unable to get checked rows on gridview

1 Answer 124 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.
Richa
Top achievements
Rank 1
Richa asked on 05 Jan 2011, 02:28 PM
Hello,

I have two GridView and one button. At first Grid I select some checkboxes and after that i have one button between grids, after clicking on buton, I need all checked rows get in one collection and then i added to it in second grid.
 
In first Grid I have one checkbox field too, please check below :
<telerik:RadGridView x:Name="gridViewStaff"  IsEnabled="{Binding ContentEnabled}" AutoGenerateColumns="False" IsReadOnly="True" ShowGroupPanel="False" ItemsSource="{Binding SearchResultsStaff}"
                                                       SelectedItem="{Binding SelectedItemStaff, Mode=TwoWay}"
                                                       Height="150" >
                                <telerik:RadGridView.Columns>
                                    <telerik:GridViewDataColumn  Header="Staff Meamber" DataMemberBinding="{Binding PersonId}"   />
                                    <telerik:GridViewDataColumn Header="Role" DataMemberBinding="{Binding }"  />
                                    <telerik:GridViewDataColumn Header="Program"  DataMemberBinding="{Binding }"   />
                                    <telerik:GridViewDataColumn Header="Start Date"  DataMemberBinding="{Binding EffectiveDate}"   />
                                    <telerik:GridViewDataColumn x:Name="chkBoxTeam"   Width="Auto" TextAlignment="Center" Header="Select for Team Member">
                                        <telerik:GridViewDataColumn.CellTemplate>
                                            <DataTemplate>
                                                <CheckBox x:Name="chkBoxTeam1" Visibility="Visible" HorizontalAlignment="Center"  />
                                            </DataTemplate>
                                        </telerik:GridViewDataColumn.CellTemplate>
                                    </telerik:GridViewDataColumn>
                                </telerik:RadGridView.Columns>
                            </telerik:RadGridView>


Please help,I am unable to get checked rows.


Thanks,
Richa

1 Answer, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 05 Jan 2011, 03:21 PM
Hello Richa,

The recommended way would be to expose a boolean property bound to the IsChecked property of the CheckBox. Thus you will be able to run through the Items collection of the grid and gather all the items, whose boolean property is True. Once you get that collection, you may bind it to the ItemsSource of the second grid.
Another possible solution would be to use the GridViewSelectColumn and set the SelectionMode property of the grid to either Extended or Multiple. Thus the SelectedItems collection of the grid will be the one to pass to the second grid.
 

Greetings,
Maya
the Telerik team
Browse the videos here>> to help you get started with RadControls for Silverlight
Tags
GridView
Asked by
Richa
Top achievements
Rank 1
Answers by
Maya
Telerik team
Share this question
or