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

[Solved] Want to selectAll value in the Edit template textbox while tabbed to it for edit

3 Answers 118 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.
Raj A R
Top achievements
Rank 1
Raj A R asked on 03 Dec 2009, 01:51 PM
Hi Team,

I want to selectAll value in the Edit template textbox  while tabbed to it for edit , I tried the below code and then cell is getting highlight on tabbing through that but the text is not selecting for edit .

I tried to make the textbox text inside the edit template to selectAll when it is getting focussed, but the GotFocus event for the textbox is not getting call while tabbing to it.


 <RadGrid:GridViewDataColumn IsVisible="True" 
                                                            UniqueName="XX">  
                                    <RadGrid:GridViewDataColumn.CellTemplate> 
                                        <DataTemplate> 
                                            <TextBlock x:Name="tbk" 
                                                       Text="{Binding Balance, Converter={StaticResource CurrencyConverter}, ConverterParameter=False}" /> 
                                        </DataTemplate> 
                                    </RadGrid:GridViewDataColumn.CellTemplate> 
                                    <RadGrid:GridViewDataColumn.CellEditTemplate> 
                                        <DataTemplate> 
                                            <TextBox x:Name="txt" 
                                                     BorderThickness="0" 
                                                     MaxLength="13" 
                                                     GotFocus="EditCellGotFocus" 
                                                     Background="Transparent" 
                                                     Padding="0,0,0,0" 
                                                     IsReadOnly="{Binding ImportSourceType, Converter={StaticResource boolToReadOnlyConverter}, Mode=OneWay}" 
                                                     Text="{Binding Balance, Mode=TwoWay}" /> 
                                        </DataTemplate> 
                                    </RadGrid:GridViewDataColumn.CellEditTemplate> 
                                </RadGrid:GridViewDataColumn> 


 

Private Sub rgvSA_CurrentCellChanged(ByVal sender As System.Object, ByVal e As Telerik.Windows.Controls.GridViewCurrentCellChangedEventArgs)

 

 

Me.rgvSA.BeginEdit()

 

e.NewCell.Focus()

 

DirectCast(DirectCast(DirectCast(e.NewCell, GridViewCell).Editor, GridViewCellEditor), GridViewTextBoxEditor).Focus()

 

 

DirectCast(e.NewCell, Telerik.Windows.Controls.GridView.GridViewCell).Cursor = Cursors.IBeam

 

 

End Sub


 

Private

 

Sub EditCellGotFocus(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs)

 

 

Dim txtEditedCell As TextBox = DirectCast(sender, TextBox)

 

txtEditedCell.SelectAll()

 

End Sub

 

 

 

how can i select the textbox value when tabbed to it for edit??

Raj
Orion systems India

3 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 03 Dec 2009, 04:15 PM
Hi Raj A R,

You can focus the TextBox using the TextBox Loaded event similar to our example.

Kind regards,
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.
0
Raj A R
Top achievements
Rank 1
answered on 04 Dec 2009, 05:23 AM
Thanks Vlad..
0
Dhileep Kumar Sampath
Top achievements
Rank 1
answered on 04 Dec 2009, 10:02 AM
Hi Vlad,
            Can we achieve the same in dynamic xaml code? i tried it.. but i am not able attach the eventhandler for textbox in the dynamic xaml.

Regards,
Dhileep
Tags
GridView
Asked by
Raj A R
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Raj A R
Top achievements
Rank 1
Dhileep Kumar Sampath
Top achievements
Rank 1
Share this question
or