RadGridView (Adding NewRow)

2 Answers 97 Views
GridView
John
Top achievements
Rank 1
John asked on 29 Jun 2021, 05:23 PM

I want to set the focus on an embedded textbox in a GridViewDataColumn

I tried on the AddingNewDataItem event the following with no success:

var grid = e.OwnerGridViewItemsControl;
grid.CurrentColumn = grid.Columns[1];

I've tried sending keys on  the RowEditEnded event. Nothing works.

 

 

 

2 Answers, 1 is accepted

Sort by
1
Accepted
Dinko | Tech Support Engineer
Telerik team
answered on 06 Jul 2021, 09:18 AM

Hello John,

Thank you for the additional details. What you can do is to manually get the TextBox inside the cell and call its Focus() method. I have prepared a sample project which demonstrates this approach. When you run the project click on the RadButton in the middle. You can observe how TextBox is focused.

Regards,
Dinko
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

-1
Dinko | Tech Support Engineer
Telerik team
answered on 02 Jul 2021, 07:19 AM

Hi John,

I am not sure what do you mean by the embedded textbox, but what you can try is to set the current cell. You can check the Set the Current Cell help article which demonstrates how to do that. Give this a try and let me know if it works for you? If not you can share some more additional information about your scenario.

Regards,
Dinko
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

John
Top achievements
Rank 1
commented on 02 Jul 2021, 03:21 PM

An embedded textbox in a GridViewDataColumn.
John
Top achievements
Rank 1
commented on 02 Jul 2021, 03:28 PM

That didn't work.
John
Top achievements
Rank 1
commented on 02 Jul 2021, 03:35 PM

<telerik.GridViewDataColumn
x:Name="example"
Width="140
Header="Example"
HeaderTextAlignment="Center"
IsGroupable="False
IsReadOnly="False">

<telerik.GridViewDataColumn.CellTemplate>
<DataTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="130" />
</Grid.ColumnDefintions>

<Texbox.......

</Grid>
</DataTemplate>
</telerik.GridViewDataColumn.CellTemplate>
</telerik.GridViewDataColumn
Tags
GridView
Asked by
John
Top achievements
Rank 1
Answers by
Dinko | Tech Support Engineer
Telerik team
Share this question
or