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

[Solved] Checkbox Select

1 Answer 109 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.
Scott Rakestraw
Top achievements
Rank 1
Scott Rakestraw asked on 23 Sep 2009, 07:42 PM
I would like for my grid to have the first column be a checkbox column and all other columns to be read only.  After the user checks the records they want they would then click a button to set all of the checked ones to allow edit.  My checkbox column looks like this.

                        <telerik:GridViewColumn HeaderText="Check"
                            <telerik:GridViewColumn.CellStyle> 
                                <Style TargetType="telerikGridView:GridViewCell"
                                    <Setter Property="Template"
                                        <Setter.Value> 
                                            <ControlTemplate TargetType="telerikGridView:GridViewCell"
                                                <Border Padding="5,0,5,0" BorderThickness="0,0,1,1" BorderBrush="#FFB3B3B3"
                                                    <CheckBox HorizontalAlignment="Center" VerticalAlignment="Center" Checked="CheckBox_Checked" /> 
                                                </Border> 
                                            </ControlTemplate> 
                                        </Setter.Value> 
                                    </Setter> 
                                </Style> 
                            </telerik:GridViewColumn.CellStyle> 
                        </telerik:GridViewColumn> 
 

I'm not sure if I need to have a field in my datasource that stores the checked state and if so how to bind this to it.  In my checked event handler I don't know how to get a reference back to the record.

I have seem some examples that use the ParentOfType extension but that does not even show up for me.  I am using the latest internal build and am not sure what I need to do to enable that. 

1 Answer, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 24 Sep 2009, 06:13 AM
Hi Scott,

Generally ParentOfType<> and ChildrenOfType<> are extension methods in Telerik.Windows.Controls namespace however you can access directly your data item using DataContext property of the CheckBox (you need to cast sender argument of the event handler to CheckBox).

All the best,
Vlad
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
GridView
Asked by
Scott Rakestraw
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Share this question
or