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

findcontrol in grid

3 Answers 115 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Bhavin
Top achievements
Rank 1
Bhavin asked on 30 Nov 2009, 10:59 PM
In a radGridView I have few readonly fields and some editable fields when we select grid and press tab ,it pu focus on readonly columns also.But I want to disable this behaviour that not to put focus on readonly tabs instead focus on editable tabs.

3 Answers, 1 is accepted

Sort by
0
Rossen Hristov
Telerik team
answered on 03 Dec 2009, 10:51 AM
Hello bhavin patel,

Everything is working fine on our side.

I have attached a sample project that behaves correctly. You can use it as a reference. The Established column of the grid is read-only. When I edit the Name and hit Tab it skips the Established column and goes directly to StatiumCapacity column. You can see a short movie of this here.

Greetings,
Ross
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.
0
Bhavin
Top achievements
Rank 1
answered on 04 Dec 2009, 04:47 PM
I have this case: Would you please test this one.

  
    <telerik:RadGridView TabIndex="0" ScrollMode="RealTime" GotFocus="RadGridView1_GotFocus"    LostFocus="RadGridView1_LostFocus"   Name="RadGridView1"  Height="150" MultipleSelect="True"   ScrollViewer.HorizontalScrollBarVisibility="Hidden"   ScrollViewer.VerticalScrollBarVisibility="Auto"   VerticalAlignment="Stretch"  ShowGroupPanel="False" ShowGroupFooters="False"   ColumnsWidthMode="Fill" ShowColumnFooters="True"  HorizontalAlignment="Stretch" IsFilteringAllowed="False"   RowIndicatorVisibility="Collapsed" AutoGenerateColumns="False"  telerik:StyleManager.Theme="Office_Black" CanUserFreezeColumns="False" AreRowDetailsFrozen="False" CellEditEnded="RadGridView1_CellEditEnded"     >

                            <telerik:RadGridView.Resources>
                                <Style TargetType ="{x:Type telerik:GridViewHeaderCell}">
                                    <Setter Property="ToolTip" Value="{Binding Content, RelativeSource={RelativeSource Self}}"/>
                                </Style>
                                <Style TargetType="telerik:GridViewCell">
                                    <EventSetter Event="MouseUp" Handler="Cell_MouseUP"/>
                                </Style>
                    
                            </telerik:RadGridView.Resources>
                            <telerik:RadGridView.Columns>
                                <telerik:GridViewDataColumn x:Name="dcVehicletype"  Focusable="False"  Header="Vehicle Type" ToolTip="Vehicle Type" IsReadOnly="True" HeaderTextAlignment="Center" TextWrapping="Wrap" IsEnabled="False"    DataMemberBinding="{Binding Path=DESCRIPTION}"     />

                                <telerik:GridViewDataColumn Header="Power Unit"  IsEnabled="False" Focusable="False"  ToolTip="Power Unit" IsReadOnly="True" HeaderTextAlignment="Center"  >
                                    <telerik:GridViewColumn.CellTemplate>
                                        <DataTemplate>
                                            <CheckBox IsEnabled="False" HorizontalAlignment="Center" VerticalAlignment="Center"  IsChecked="{Binding Path=POWER_UNIT,Converter={StaticResource BoolConverter}}" ></CheckBox>
                                        </DataTemplate>
                                    </telerik:GridViewColumn.CellTemplate>
                                </telerik:GridViewDataColumn>
                                <telerik:GridViewDataColumn Header="Passenger Unit"  IsEnabled="False" Focusable="False"  ToolTip="Passenger Unit" IsReadOnly="True" HeaderTextAlignment="Center">
                                    <telerik:GridViewColumn.CellTemplate >
                                        <DataTemplate>
                                            <CheckBox IsEnabled="False" HorizontalAlignment="Center" VerticalAlignment="Center"  IsChecked="{Binding Path=PASSENGER_UNIT,Converter={StaticResource BoolConverter}}" ></CheckBox>
                                        </DataTemplate>
                                    </telerik:GridViewColumn.CellTemplate>
                                </telerik:GridViewDataColumn>
                                <telerik:GridViewDataColumn Header="HM Capable"  IsEnabled="False" Focusable="False"  HeaderTextAlignment="Center" IsReadOnly="True" ToolTip="HM Capable">
                                    <telerik:GridViewColumn.CellTemplate>
                                        <DataTemplate>
                                            <CheckBox IsEnabled="False" HorizontalAlignment="Center" VerticalAlignment="Center"  IsChecked="{Binding Path=HM_CAPABLE,Converter={StaticResource BoolConverter}}" ></CheckBox>
                                        </DataTemplate>
                                    </telerik:GridViewColumn.CellTemplate>
                                </telerik:GridViewDataColumn>
                                <telerik:GridViewDataColumn Header="Total"  Focusable="False"   TextAlignment="Center"  IsReadOnly="True" IsEnabled="False"   DataMemberBinding="{Binding x:null}"  HeaderTextAlignment="Center" >
                                    <telerik:GridViewColumn.CellTemplate  >
                                        <DataTemplate>
                                            <TextBlock Foreground="Gray" IsEnabled="False"  HorizontalAlignment="Center" VerticalAlignment="Center" Text="{Binding TOTAL}" >
                                            </TextBlock>
                                        </DataTemplate>
                                    </telerik:GridViewColumn.CellTemplate>
                                </telerik:GridViewDataColumn>


                                <telerik:GridViewDataColumn   Header="Owned"  Focusable="true"  TextAlignment="Center"  ToolTip="Owned" IsReadOnly="True"   HeaderTextAlignment="Center" DataMemberBinding="{Binding x:null}"  >

                                    <telerik:GridViewColumn.CellTemplate>
                                        <DataTemplate>
                                            <ctrlMaskedTxt:MaskedTextBox InputMask="iii"  Focusable="True"  Style="{StaticResource TxtBackground}" FontWeight="Bold" HorizontalAlignment="Center" Tag="{Binding}"  VerticalAlignment="Top" Width="40" TextChanged="TxtOwned_TextChanged"   x:Name="TxtOwned" Margin="5,0" Text="{Binding OWNED}" >
                                            </ctrlMaskedTxt:MaskedTextBox>
                                        </DataTemplate>
                                    </telerik:GridViewColumn.CellTemplate>

                                    <telerik:GridViewDataColumn.AggregateFunctions>
                                        <telerik:SumFunction Caption="Owned: "  SourceField="OWNED" />
                                    </telerik:GridViewDataColumn.AggregateFunctions>
                                </telerik:GridViewDataColumn>

                               <telerik:GridViewDataColumn Header="Term Leased" Focusable="true"   ToolTip="Term Leased" HeaderTextAlignment="Center" DataMemberBinding="{Binding x:null}" IsReadOnly="True"  >

                                    <telerik:GridViewColumn.CellTemplate>
                                        <DataTemplate>
                                            <ctrlMaskedTxt:MaskedTextBox InputMask="iii" Style="{StaticResource TxtBackground}" FontWeight="Bold" HorizontalAlignment="Center"  Tag="{Binding}"  VerticalAlignment="Top" Width="40"  TextChanged="TxtTermLeased_TextChanged"   x:Name="TxtTermLeased" Margin="5,0" Text="{Binding TERM_LEASED}" >

                                            </ctrlMaskedTxt:MaskedTextBox>
                                        </DataTemplate>
                                    </telerik:GridViewColumn.CellTemplate>
                                    <telerik:GridViewDataColumn.AggregateFunctions>
                                        <telerik:SumFunction Caption="Term Leased: "  SourceField="TERM_LEASED" />
                                    </telerik:GridViewDataColumn.AggregateFunctions>
                                </telerik:GridViewDataColumn>
                                <telerik:GridViewDataColumn  Header="Trip Leased" Focusable="true" TextAlignment="Center" ToolTip="Trip Leased" HeaderTextAlignment="Center"  DataMemberBinding="{Binding x:null}" IsReadOnly="True"  >

                                    <telerik:GridViewColumn.CellTemplate>
                                        <DataTemplate>
                                            <ctrlMaskedTxt:MaskedTextBox InputMask="iii" Style="{StaticResource TxtBackground}" FontWeight="Bold" HorizontalAlignment="Center" Tag="{Binding}"  VerticalAlignment="Top" Width="40" TextChanged="TxtTripLeased_TextChanged"   x:Name="TxtTripLeased"  Margin="5,0" Text="{Binding TRIP_LEASED}" >
                                            </ctrlMaskedTxt:MaskedTextBox>
                                        </DataTemplate>
                                    </telerik:GridViewColumn.CellTemplate>
                                    <telerik:GridViewDataColumn.AggregateFunctions>
                                        <telerik:SumFunction Caption="Trip Leased: "  SourceField="TRIP_LEASED" />
                                    </telerik:GridViewDataColumn.AggregateFunctions>
                                </telerik:GridViewDataColumn>

                            </telerik:RadGridView.Columns>

                        </telerik:RadGridView>
0
Rossen Hristov
Telerik team
answered on 07 Dec 2009, 01:13 PM
Hi bhavin patel,

IsReadOnly is related to not showing the editor created from a CellEditTemplate. In your case you have a CellTemplate and that is why you are probably entering it. CellTemplate is for displaying stuff and CellEditTemplate is for editing struff. IsReadOnly prevents editing and not displaying. I hope this helps.

Kind regards,
Ross
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
Bhavin
Top achievements
Rank 1
Answers by
Rossen Hristov
Telerik team
Bhavin
Top achievements
Rank 1
Share this question
or