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

select SearchAsYouType on startup

2 Answers 77 Views
GridView
This is a migrated thread and some comments may be shown as answers.
David
Top achievements
Rank 1
David asked on 10 Oct 2018, 04:48 PM

Is there a way to have the Search box selected when a window with RadGridView is initialized? I want the user to be able to search straight away, without having to first click on the search box to enter text.

 

2 Answers, 1 is accepted

Sort by
0
Dinko | Tech Support Engineer
Telerik team
answered on 15 Oct 2018, 07:02 AM
Hi David,

To focus the search text box initially you can subscribe to the Loaded event of the RadGridView. In the event handler, you can get the TextBox (x:Name="PART_SearchAsYouTypeTextBox") using our ChildrenOfType<T>() extension method. Then you can call the Focus() method to focus the text box. Check the following code snippet.
private void GridView_Loaded(object sender, RoutedEventArgs e)
{
    var txtBox = (sender as RadGridView).ChildrenOfType<TextBox>().FirstOrDefault(x=>x.Name == "PART_SearchAsYouTypeTextBox");
    if(txtBox!= null)
    {
        txtBox.Focus();
    }
}

Regards,
Dinko
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
David
Top achievements
Rank 1
answered on 15 Oct 2018, 03:43 PM
Thanks Dinko - that has worked perfectly!
Tags
GridView
Asked by
David
Top achievements
Rank 1
Answers by
Dinko | Tech Support Engineer
Telerik team
David
Top achievements
Rank 1
Share this question
or